val commandTriggeredFlow = Flow() { implicit b => import FlowGraph.Implicits._ // broadcast the command to the elasticsearch source and the tick system val bcast = b.add(Broadcast[Command](2)) val zip = b.add(Zip[Command, Seq[Question]]())
// forward the ticks
bcast.out(0) ~> zip.in0 // filter out the Next commands bcast.out(1) .filter(_.isInstanceOf[Search]) .map { case Search(term) => query(term) } .flatten(FlattenStrategy.concat)
// group results to get a "per next result batch" .grouped(2) ~> zip.in1
(bcast.in, zip.out)}
> search:first
< (Search(first),Vector(Question(1,First Question ever asked!,This is my first question!), Question(1,First Question ever asked!,This is my first question!)))> next
< >
--
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Patrik Nordwall
Typesafe - Reactive apps on the JVM
Twitter: @patriknw