-
1. Re: core and "topics" without JMS
jmesnil Jul 23, 2012 8:27 AM (in response to unficyp)You are confusing the semantics of HornetQ core API
Have a look at http://www.slideshare.net/gavinhogan/hornet-q-andthewebjudcon2010-7381151 (esp. starting from slide 53).
basically, using HornetQ core API, you send to an *address* and receives from *queues*
it's the way you bind queues to address that defines the messaging model
coreSession.createQueue(topicName, topicName, true);
=> You have created a queue with the name topicName (2nd param) bound to the *address* topicName (1st param)
session.createTemporaryQueue(topicName, clientID);
=> You create a temp queue named clientID bound to the *address* topicName
messageConsumer = session.createConsumer(topicName,"CCAgent = '"+filter+"'");
=> You have create a consumer which will receive message from the *queue* named topicName. That's not what you want.
From your code, the 2 consumers receives messages from the queue named *topicName*, not from the temp queues you have created.
Have a look at the HornetQ javadoc API to avoid confusing address, queues: http://docs.jboss.org/hornetq/2.3.0.Alpha/docs/api/org/hornetq/api/core/client/ClientSession.html
To fix this:
1. There is no need to create a queue for the producer, it will send messages to an *address* fsevents
2. Create temp queues named "client1" & "client2" bound to the "fsevents" address
3. create consumers for the temp queues "client1" & "client2" and you're all set.
jeff
-
2. Re: core and "topics" without JMS
unficyp Jul 23, 2012 9:21 AM (in response to jmesnil)Thanks Jeff, the slides made it very clear.
Changes my code and it's working now.
Thanks !