object Test extends App {
implicit val sys = ActorSystem("streamSys")
implicit val ec = sys.dispatcher
implicit val mat = ActorMaterializer(
ActorMaterializerSettings(sys)
.withInputBuffer(1,1)
)
case class Tick()
RunnableGraph.fromGraph(GraphDSL.create() { implicit b =>
import GraphDSL.Implicits._
// this is the asynchronous stage in this graph
val zipper = b.add(ZipWith[Tick, Seq[String], Int]((tick, count) =>
count.length).async)
// this slows down the pipeline by 3 seconds
Source.tick(initialDelay = 3.seconds, interval = 3000.milliseconds,
Tick()) ~> zipper.in0
// faster producer with all elements passed inside a Seq
Source.tick(initialDelay = 1.second, interval = 1.milliseconds, "item")
.conflateWithSeed(Seq(_)) { (acc,elem) => acc :+ elem } ~> zipper.in1
zipper.out ~> Sink.foreach(println)
ClosedShape
}).run()
}
hello, I was a akka beginer and confused about why this code result 'seq
length' was 300 instand of 3000?
--
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user
google-group soon.
** This group will soon be put into read-only mode, and replaced by
discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
>>>>>>>>>>
>>>>>>>>>> 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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.