Question

I would like to translate the concept of JMS topics using HornetQ core API.

The problem i see from my brief examination it would appear the main class JMSServerManagerImpl (from hornetq-jms.jar) uses jndi to coordinate the various collaborators it requires. I would like to avoid jndi as it is not self contained and is a globally shared object which is a problem especially in an osgi environment. One alternative is to copy starting at JMSServerManagerImpl but that seems like a lot of work.

I would rather have a confirmation that my approach to emulating how topics are supported in hornetq is the right way to solve this problem. If anyone has sufficient knowledge perhaps they can comment on what i think is the approach to writing my own emulation of topics using the core api.

ASSUMPTION

  • if a message consumer fails (via rollback) the container will try deliverying the message to another different consumer for the same topic.

EMULATION

  1. wrap each message that is added for the topic.
  2. sender sends msg w/ an acknowledgement handler set.
  3. the wrapper for (1) would rollback after the real listener returns.
  4. the sender then acknowledges delivery

I am assuming after 4 the msg is delivered after being given to all msg receivers. If i have made any mistakes or my assumptions are wrong please comment. Im not sure exactly if this assumption of how acknowledgements work is correct so any pointers would be nice.

Was it helpful?

Solution 2

http://hornetq.sourceforge.net/docs/hornetq-2.0.0.BETA5/user-manual/en/html/using-jms.html

7.5. Directly instantiating JMS Resources without using JNDI

OTHER TIPS

If you are trying to figure out how to send a message to multiple consumers using the core API; here is what I recommend

  1. Create queue 1 and bind to address1
  2. Create queue 2 and bind to address1
  3. Make queue N and bind to address 1

  4. Send a message on address1

  5. Start N consumers where each consumer listens on queue 1-N

This way it basically works like a topic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top