Hi, I am trying to look into the EventBus functionality in Akka and I started off with looking at the documentation provided. I started with - http://doc.akka.io/docs/akka/2.3.0-RC3/java/event-bus.html#Lookup_Classification
I extended the base class as stated in the example and I was able to subscribe actors to the EventBus and was able to publish messages to various subscribers. The issue came in when I passed the reference of the LookupServiceImpl to an Actor class via its constructor. *All I was trying to achieve is to write an Actor which would publish the message it receives to the EventBus Implementation.* My Actor is the following : public class EventActor extends UntypedActor { private LookupEventBus eventBus; public EventActor() { } public EventActor(LookupEventBus eventBus) { this.eventBus = eventBus; System.out.println("TEST"+eventBus.toString()); System.out.println("TEST"+eventBus.mapSize()); } @Override public void onReceive(Object message) throws Exception { // TODO Auto-generated method stub //System.out.println("RegistrationEventActor ::"+message); //eventBus.publish(message); if(message instanceof TestEvent) { System.out.println("RegistrationEventActor ::"+message); //System.out.println("Test:"+eventBus.); /*if(eventBus instanceof LookupBusImpl) { ((LookupBusImpl)eventBus).publish((TestEvent)message); }*/ eventBus.publish((TestEvent)message); //ActorSelection registrationEventOuboundActor = } } } My JUnit Test case is the following : public void testAkkaLookupBusImpl() { //Subscriber could be on another JVM final ActorSystem outboundActorSystem = ActorSystem.create( "OutboundSubscriberActorSystem"); final ActorRef eventOutboundActor = outboundActorSystem.actorOf(Props.create(RegistrationEventOutboundActor. class),"EventOuboundActor"); final ActorRef basicOutboundActor = outboundActorSystem.actorOf(Props.create(BasicRegistrationEventOutboundActor. class),"BasicEventOuboundActor"); //LookupBusImpl is same as given in the Akka example documentation. LookupBusImpl lookUpBusEvent = new LookupBusImpl(); lookUpBusEvent.subscribe(eventOutboundActor, "Event"); lookUpBusEvent.subscribe(basicOutboundActor, "Event"); System.out.println(lookUpBusEvent.toString()); System.out.println("Map Size:"+lookUpBusEvent.mapSize()); //Event Generation Actor System final ActorSystem eventGenerationActorSystem = ActorSystem.create( "EventGenerationActorSystem"); final ActorRef eventActor = eventGenerationActorSystem.actorOf(Props.create(EventActor.class, lookUpBusEvent),"Event"); System.out.println("Event Generation Path::"+ eventActor.path()); final TestEvent test = new TestEvent("Event", "1"); eventActor.tell(test,ActorRef.noSender()); } When the eventActor.tell(test,ActorRef.noSender()) is invoked , a message is sent to the Actor , but the message is not published to the Subscribers. Is there something that I am doing which is not correct ? Or is the EventBus not to be combined inside an Actor model ?? Can someone please throw some light on this ? Thanks in Advance, Sree. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.