1

I do not understand how to handle errornous messages when using a JMS topic. I have a persistent JMS Topic with 4 subscribers. I send a message to the topic. 3 of the subscribers consume the message successfully, one fails. After some retries the message is put in the dead letter queue (DLQ).

The question is, how to continue from there.

  1. How can I find out which subscriber failed?

  2. How can I redeliver the message only to that subscriber? I cannot just put it into the topic again, since all subscribers would get it then.

Are there some best practices to handle this case?

If that matters, I use Glassfish 3.1.2 with an openMQ. I would prefer to use a solution that is not specific to the implementation of the messaging provider.

Thanks in advance for your answer. Cheers Arne

Arne
  • 65
  • 7
  • Are you using message Acknowledgments? If not I guess you might need to rethink your design. Probably you need to wait for the ACK, and change the logic based on these – maverick Oct 11 '12 at 16:21
  • @maverick I see that Acknowledgments would solve question 1, is there a mechanism I could use to solve question 2? – Arne Oct 12 '12 at 06:44
  • well once the ACK wasn't received in a considerable amount of time, and if no store and forward is supported, what about creating a simple queue and reattempt the delivery through that queue?. Seems that at this point the solution becomes like a monster, now you have to care for the topic and the queue. Or try a hand-made store and forward on each consumer?.. Just my two cents.. – maverick Oct 12 '12 at 19:49

1 Answers1

1

Well, I'm not very familiar with openmq, but a lot of jms providers have an ability to forward messages from topic to queues. So the message producer sends messages to a topic, then jms provider forwards a separate copy of a message to a separate queue for each consumer. Each consumer has its own DLQ.

There are the following benefits:

  1. Guaranteed SLA for each queue consumer (for example, slow consumer can slow down other consumers, in case with separate queues that's not so).
  2. There will no a consumer that can lose a message (topics with durable subscriptions will deliver only messages after you firstly subscribe to this topic).
  3. Some problems with clustering can be solved easily (subscribers (MDBs) to the topics in a clustered environment as a rule will receive messages as many times as a count of nodes in the cluster)
szhem
  • 4,672
  • 2
  • 18
  • 30
  • Thank you for your answer. This would indeed solve the problem. Unfortunately openMQ does not support store and forward messaging at the moment. But it is [planned](http://mq.java.net/road-map.html). Benefit 3 that you describe will be very helpful for us in the future, since we plan to use clusters. Thanks for that hint. – Arne Oct 12 '12 at 07:40