Hi Eric, You'll need to instruct the connect of the Sink to keep its materialized value rather than the Flows:
val src = Source(immutable.Seq(1,2,3)) val flo = Flow[Int].map(_ * 2) val sin = Sink.foreach(println) val runFlow = (src via flo).toMat(sin)(Keep.right) val fut = runFlow.run() fut.onComplete(_ => sys.shutdown()) On Thu, Jun 11, 2015 at 6:26 PM, Eric Kolotyluk <[email protected]> wrote: > I have some simple code > > logger.info( "Hello World!" ) > > implicit val system = ActorSystem("System") > import system.dispatcher > > logger.info("Create a Source based on a simple Iterable[T]") > val source = Source(1 to 10) > > logger.info("Create sink1 that can be connected to the Source" ) > val sink1 = Sink.foreach { int: Int => logger.info("sink1: " + int) } > > logger.info("Connect the Source to the sink1, obtaining a runnableFlow1" > ) > val runnableFlow1: RunnableFlow[Unit] = source.to(sink1) > > logger.info("Create flowMaterializer1") > val flowMaterializer1 = ActorFlowMaterializer() > > logger.info("Materialize runnableFlow1 as materializedFlow1") > val materializedFlow1 = runnableFlow1.run()(flowMaterializer1) > > // How do I know when materializedFlow1 is finished so I can shut down > the actor system? > > Cheers, Eric > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: > http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Cheers, √ -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
