views:

610

answers:

3

I'm hoping someone can help me - I'm using JBoss 5.1 and MQ Series 7 in an EJB / JMS based application. I have several message driven beans in my application, each listening on an MQ Series message queue. When an error is encountered during the processing of a message, I need to be able to configure a 'retry delay', so that mq series waits some period of time before attempting to redeliver the message. I have combed through MQ Series documentation extensively, and have not yet found a way to accomplish this in MQ Series. I know that the JBoss default JMS provider has a way to do this, but I am currently limited to using MQ Series. Since I haven't been able to set a retry delay - when I have a message that fails, my application gets stuck in a tight loop of delivering the message and rolling back continuously. Can anyone help me understand if there is some config option in MQ Series that will allow me to wait X milliseconds before redelivering a failed message?

+1  A: 

Hi,

I think you're out of luck. As far as I know the only parameters you can tweak in this scenario is the max number of times the message will be retried (BOTHRESH) and the name of the exception/backout queue (BOQUEUE) where the message will be sent if the number of retry attempts exceeds the max.

Paal

Paal Thorstensen
+2  A: 

This is likely to be an opportunity to craft a little infrastructure for such an issue.

Since you can look at the JMSDeliveryCount when the message has entered the bean (before you process it -- consider commit scope) and you can see that it has had a couple of rollbacks already, send the message around to a staging queue but attach the destination queue name in the jms properties so you can use it later.

A simple process can run on some interval to clear the staging queue (every 5 minutes for example) and send the message on to a routing queue.

Another process can sit on the routing queue and look at the jms properties (which added the destination queue name to) and send the message along to the orginal destination.

It's a poor man's broker but it will acheive the goal. It is true that there is not much built in to really do what you want.

Tres
A: 

You can specify a retry limit so that the continuous rollback will stop after a specified attempts.

Ganesh