February 2018
Intermediate to advanced
552 pages
13h 46m
English
Now, we will try to connect all three major components of the Akka Streams API:
val numbersSource = Source(1 to 10) val sampleSink = Sink.foreach(println) val numberFlow = Flow[Int].map(num => num+1)
Create all three components to work on numbers. We can use Source's via function to connect a Source to Flow and Flow's to function to connect a Flow to Sink.
val numberRunnableGraph = numbersSource.via(numberFlow).to(sampleSink)
This is a fully connected RunnableGraph with all three components. When we run this code, it also does give any output.