0

I have an actor hierarchy, with a WebsocketActor in the top of it. It handles the connection to third-party service and has n SessionActor actors that handle complex logic. Now I want, when the system shuts down, that every SessionActor sends it's last message to WebsocketActor actor (like "ok, terminate my session"). But since the inbox is stopped for the WebsocketActor, it just didn't work.

I tried shutdownGracefully() method, and aware of Reaper pattern, but not sure if it will fit me.

Stack I use is: Akka+Netty andjavax.websocket.*; to handle third-party websocket service

1 Answers1

0

There is no standard mechanism in akka to allow exactly what you require.

You have to implement such "clean up" mechanism on your own.

This mechanism has to be started and quite importantly has to finish before initiation of actor system termination.

Though, implementing such mechanism is possible, you might want to reconsider using akka in general.

If you require guaranteed deliveries of messages in your system, akka is not suited for you. It comes with "At most once delivery" policy, which means that there is not built-in logic for message redelivery and acknowledgements. Check out message-delivery-reliability.

Ivan Stanislavciuc
  • 7,140
  • 15
  • 18