akka-stream-contrib icon indicating copy to clipboard operation
akka-stream-contrib copied to clipboard

FlowDeathPact

Open ktoso opened this issue 8 years ago • 6 comments

Allow terminating a stage on actor termination or the other way around, might be useful in Akka HTTP when we want to have an actor as long as the request/response flow is alive etc.

I implemented an initial version here: https://github.com/akka/akka/pull/21076

ktoso avatar Oct 17 '16 08:10 ktoso

This assumes a specific Materializer, doesn't it? Seems like a concern violation.

On Mon, Oct 17, 2016 at 10:43 AM, Konrad Malawski [email protected] wrote:

Allow terminating a stage on actor termination or the other way around, might be useful in Akka HTTP when we want to have an actor as long as the request/response flow is alive etc.

I implemented an initial version here: akka/akka#21076 https://github.com/akka/akka/pull/21076

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/akka/akka-stream-contrib/issues/74, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAqd96fiL4uxbyFdvdZaBsKXl910TNOks5q0zU8gaJpZM4KYXhL .

Cheers, √

viktorklang avatar Oct 17 '16 08:10 viktorklang

I don't see how it assumes any materializer. It makes most sense when used with the Actor one, sure. As does entire Akka HTTP 😉

We have a bad user experience in binding lifecycles of Flows and Actors, it's like two worlds that are hard to connect properly (yes, it's a common complaint)

ktoso avatar Oct 17 '16 08:10 ktoso

@ktoso What does DeathPact mean in a non ActorMaterializer context?

viktorklang avatar Oct 17 '16 08:10 viktorklang

How does that have anything to do with ActorMaterializer? Check the impl. https://github.com/akka/akka/pull/21076/files

Flow dies if "watched" Actor dies. Actor dies if "watched" Flow dies.

Any materializer can implement this. Which doesn't mean that will be the common use case, the common use case is when in Akka HTTP we currently tell people "oh yeah you have to write this much code to bind these lifecycles" – we're being very unhelpful in face of a real typical pattern right now, and this operation helps there.

Note also that this is akka-stream-contrib, where more liberal operations are accepted.

ktoso avatar Oct 17 '16 08:10 ktoso

Doh! I understood it as being able to DeathWatching the Actor running the GraphInterpreter…

Sorry for the noise!

viktorklang avatar Oct 17 '16 08:10 viktorklang

No problem, cheers! 🍻

ktoso avatar Oct 17 '16 08:10 ktoso