I have a question about the use of Akka Streams and Akka Cluster. I'm trying to make a version of distributed word count using Akka Streams and Akka Cluster.
I would like to build an Akka Streams client that reads a text file as streaming I/O and sends the stream of words to a remote cluster. This is the code of the client:
final Path file = Paths.get("example.txt");
final Source<ByteString, CompletionStage<IOResult>> read = FileIO.fromPath(file);
final Source<Pair<String, Integer>, CompletionStage<IOResult>> counts =
read
.via(Framing.delimiter(ByteString.fromString(" "), 256, FramingTruncation.ALLOW))
.map(i -> i.utf8String())
.runWith(/* send to Akka cluster */);
I don't understand what I have to use to send streaming data to an Akka cluster without losing the bases of Akka Streams (backpressure, etc.).
I know of the existence of Stream refs and Cluster Client but I don't understand which of them to use.