Take the 2-minute tour ×

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.


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


  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.

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment
up vote 0 down vote accepted


7.5. Directly instantiating JMS Resources without using JNDI

share|improve this answer
Actually this is not the right answer, the next question where you create multiple queues is the right answer... A Topic subscription is nothing else than a core-queue. –  Clebert Dec 1 '11 at 14:40
add comment

Your Answer


