--
>>>>>>>>>> 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.
Flow() { implicit builder ⇒
val promises = builder add Source(() ⇒ Iterator continually Promise[O]())
val fan = builder add Broadcast[Promise[O]](2)
val zip = builder add Zip[I, Promise[O]]()
val flow = builder add Flow[Promise[O]].mapAsync(1)(_.future)
val sink = builder add Sink.actorSubscriber[I, Promise[O]](props)
//+Flow: @formatter:off
promises ~> fan ~> zip.in1
flow <~ fan
sink <~ zip.out
//-Flow: @formatter:on
zip.in0 → flow.outlet
}
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
Well, I was able to achieve needed behavior with following flow scheme:Flow() { implicit builder ⇒
val promises = builder add Source(() ⇒ Iterator continually Promise[O]())
val fan = builder add Broadcast[Promise[O]](2)
val zip = builder add Zip[I, Promise[O]]()
val flow = builder add Flow[Promise[O]].mapAsync(1)(_.future)
val sink = builder add Sink.actorSubscriber[I, Promise[O]](props)
//+Flow: @formatter:off
promises ~> fan ~> zip.in1
flow <~ fan
sink <~ zip.out
//-Flow: @formatter:on
zip.in0 → flow.outlet
}
Where `I` and `O` are input and output types, respectfully, and `props` is `Props(..)` of enrichment Actor, who receives Tuple(i: I, p: Promise[O]), enriches i to instance of `O` and fulfills promise.But there is still some questions I would very much like to know answers to:1. Is there a way to create lazy repeated Source of (: => Promise[O])?Logs show that Source(() => Iterator continually Promise[O]()) eagerly produces several promised values, and if actual inlet completes after very first instance of `I` they are discarded.
2. Is there a simpler way to produce Flow[O] from Flow[Promise[O]] than via `.mapAsync(1)(_.future)`?
3. Will Sink.actorSubscriber(..) shutdown underlying actor after stream is completed or it needs to be done from actor itself after OnComplete event? And what about errors?
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.
--
>>>>>>>>>> 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.
On Fri, Aug 21, 2015 at 5:46 PM, Alexey Shuksto <sei...@gmail.com> wrote:Well, I was able to achieve needed behavior with following flow scheme:Flow() { implicit builder ⇒
val promises = builder add Source(() ⇒ Iterator continually Promise[O]())
val fan = builder add Broadcast[Promise[O]](2)
val zip = builder add Zip[I, Promise[O]]()
val flow = builder add Flow[Promise[O]].mapAsync(1)(_.future)
val sink = builder add Sink.actorSubscriber[I, Promise[O]](props)
//+Flow: @formatter:off
promises ~> fan ~> zip.in1
flow <~ fan
sink <~ zip.out
//-Flow: @formatter:on
zip.in0 → flow.outlet
}
Where `I` and `O` are input and output types, respectfully, and `props` is `Props(..)` of enrichment Actor, who receives Tuple(i: I, p: Promise[O]), enriches i to instance of `O` and fulfills promise.But there is still some questions I would very much like to know answers to:1. Is there a way to create lazy repeated Source of (: => Promise[O])?Logs show that Source(() => Iterator continually Promise[O]()) eagerly produces several promised values, and if actual inlet completes after very first instance of `I` they are discarded.I think that is because elements are prefetched from the source, but that should be bounded to the buffer size.
val fan = builder add Broadcast[Promise[O]](2) buffer (1, OverflowStrategy.dropBuffer)
2. Is there a simpler way to produce Flow[O] from Flow[Promise[O]] than via `.mapAsync(1)(_.future)`?Isn't that simple enough?
3. Will Sink.actorSubscriber(..) shutdown underlying actor after stream is completed or it needs to be done from actor itself after OnComplete event? And what about errors?ActorSubscriber doesn't (currently) stop automatically when it receives OnComplete/OnError. There are some use cases when it is needed to not stop, but I think we should change the default behaviour to stop.There is several tickets around this: https://github.com/akka/akka/issues/17286
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/JyWMymHFuXs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.