Now, it's time to run our RunnableGraph here and find the results. We can run a RunnableGraph by calling its run function, as follows:
import akka.stream.scaladsl.{Flow, Sink, Source}
object AkkaStreamsNumbersApp extends App{
val numbersSource = Source(1 to 10)
val sampleSink = Sink.foreach(println)
val numberFlow = Flow[Int].map(num => num+1)
val numberRunnableGraph =
numbersSource.via(numberFlow).to(sampleSink)
numberRunnableGraph.run
}
When we run the preceding program, we will get the following error messages:
Error:(18, 23) could not find implicit value for parameter materializer: akka.stream.Materializer
numberRunnableGraph.run
Error:(18, 23) not enough arguments for method run: (implicit materializer: akka.stream.Materializer)akka.NotUsed.
Unspecified value parameter materializer.
numberRunnableGraph...