2016-04-29 8 views

Antwort

0

die Lösung gefunden:

val g = RunnableGraph.fromGraph(GraphDSL.create() { implicit builder => 
    import GraphDSL.Implicits._ 

    val in = Source(1 to 10) 

    val out = Sink.foreach(println) 

    val concat = builder.add(Concat[Int](2)) 

    val f1 = Flow[Int].fold(0) { (acc, el) => 
     el 
    } 

    in ~> f1 ~> concat 

    // creating new source from old stream last value 
    in.via(f1).flatMapConcat(_ => Source(666 to 670)) ~> concat 

    concat ~> out 

    ClosedShape 
    }) 
    g.run()