February 2018
Intermediate to advanced
552 pages
13h 46m
English
As we discussed in the Akka Streams API section, only the Source and Sink components are mandatory to form a Graph or RunnableGraph. The rest of the API components are optional.
Even though we cannot do much with just the Source and Sink components, we can use and run the Graph:
val numbersSource = Source(1 to 10)
val numberSink = Sink.foreach(println)
Here, we have created both Source and Sink:
val numberRunnableGraph = numbersSource.to(numberSink)
Now we have connected our Source to our Sink using the to functions available in the Source component. It forms a simple RunnableGraph. When we run this code in a Scala App, it executes successfully without any output to the console.
Read now
Unlock full access