Search code examples
akkaevent-busakka-remote-actor

Retrieving node address from RemotingShutdownEvent


We're currently updating from Akka 2.0.4 to 2.4.2 (I know, quite a big leap, but nobody thought to do it incrementally).

Anyway, in the old codebase, our master node is connected to some remote slave nodes that sometimes fail (the "why" is still to be investigated). When a slave dies, the master receives a RemoteClientShutdown event from which we can extract the getRemoteAddress and process it accordingly (e.g. inform the admin per email pointing to the failed node address).

In version 2.4.2 the RemoteClientShutdown class is replaced (at least I suppose so) by RemotingShutdownEvent which, being an object, doesn't carry any specific information as to the source of the event.

I've checked the migration guides as well as the current documentation but couldn't find info on how to solve this problem. According to the Event Bus documentation, the only way to extract such information is by providing it in the message ("Please note that the EventBus does not preserve the sender of the published messages. If you need a reference to the original sender you have to provide it inside the message").

Should I somehow override the message sent on the remote system shutdown? Or is there any other recommended way to solve it? I hope this question is not too newbie, I'm still quite new to Akka.


Solution

  • Ok, solved it using DisassociatedEvent which actually contains the address and other useful information. Turns out I was misled by the name of RemotingShutdownEvent which is actually received "when the remoting subsystem has been shut down" (docs) and not when a remote actor has been shut down.