Reputation: 376
Does Akka's EventBus work with remote actors?
As far as I can tell, it doesn't natively support this. Can anyone confirm please?
It looks like it would be possible to code some Actors that provide similar functionality. E.g. start up a remote actor that subscribes to the EventBus on the remote server, and send the messages back to a local actor to republish on the local EventBus. But there is no point writing this, if it is already supported!
Thanks
Upvotes: 9
Views: 1775
Reputation: 15472
The EventBus itself is local, meaning that events are not automatically transferred to EventBuses on other systems, but you can subscribe any ActorRef you want, including remote ones. You only need an actor on the node where the events are generated:
case class Subscribe(clazz: Class[_])
system.actorOf(Props(new Actor {
def receive = {
case Subscribe(c) =>
context.system.eventStream.subscribe(sender, c)
}
}), "eventer")
Then you can look that one up from remote hosts and have yourself subscribed.
Upvotes: 11