Example of Akka EventBus for Java
I think you're just one line short:
final ActorSystem actorSystem = ActorSystem.create("ServerEvents");
final ActorRef actor = actorSystem.actorOf(new Props(SeverEventHandler.class));
actorSystem.eventStream().subscribe(actor,ServerMessage.class);
actorSystem.eventStream().publish(new ServerMessage()); <<== add this
While ServerEventHandler should be something like
public class ServerEventHandler extends UntypedActor {
@Override
public void onReceive(final Object message) {
System.out.println("Got event in thread: " + Thread.currentThread().getName());
System.out.println("Event: " + message);
}
}