-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving multiple responses asynchronously #268
Comments
One conceptually nice solution for this use case might be to allow the response to be a for {
// ...
response <- actor.unsafeOp(envelope.command).either
_ <- response match {
case stream: zio.stream.Stream[_, Any] => stream.foreach(writeToWire(worker, _))
case _ => writeToWire(worker, response)
}
} yield () |
I may be misunderstood the question, but this problem can also arise in Akka Typed. In Akka untyped context contains the So the solution in your case could be to just pass the sender along with the message and use |
Yes, that would be an option, but less elegant than the |
Hi all,
I'm trying to write a zio-actor for the originally Akka based Petri Net implementation Kagera.
The Akka implementation does one thing that I don't know how to do in zio-actors:
When an actor
A
sends the Petri Net actorB
a command to fire a transition,B
sends a correspondingTransitionResponse
(that's easy to do in zio-actors), but then other transitions can automatically fire and in the Akka implementation this sends additionalTransitionResponse
s back toA
asynchronously whenever the automatic transitions have fired (corresponding test).Afais, a
Stateful
actor never gets to know the actor who sent it a message, so just sendingA
an additionalTransitionResponse
via!
won't work.The only idea I have for implementing this in zio-actors is to return a
Seq[TransitionResponse]
, but that means that one has to await all transitions to finish before sending the response.I hope this is understandable without knowing too much about Petri Nets.
Is there any way to get something like this to work?
The text was updated successfully, but these errors were encountered: