4
votes

I have a system that reads messages from a IBM MQ. From this queue we sometimes get corrupt data. If a message has failed the next time it is read the listener will wait 5 minutes before proceeding. When a message has failed 3 times it is put on a Backoff-queue. The JMSContainerFacotry is set up to run max 10 in parallell. This means if we get a big batch of corrupt messages these messages take 10+ minutes each to reach the Backoff-queue (which is ok), but they end up consuming all the threads so other messages must wait for all the corrupt to reach the Backoff-queue before being processed. I want to remove the wait() from the listener so that this doesnt block threads, but that failed messages still wait 5 minutes before popping back up.

I know that with ActiveMQ you can tell the queue to wait 5 minutes before popping the same message again, with IBM MQ I dont have that possibility. Is it possible to put failed messages to the back off the queue? Now failed messages seems to pop in front of new ones. Or set the jmspriority on failed messages lower. So that if there is messages that have yet to fail will get popped from the queue before those that have failed?

My listener is about so:

@JMSListener()
public void listen(Object message) {
TextMessage textMessage = (TextMessage) message;

if (textMessage.getIntProperty("JMSXDeliveryCount") > 1) {
 //pause for 5 minutes
}

//buisness logic

}

The in-queue is a IBM MQ. AS is Jboss 6.

2

2 Answers

0
votes

Not sure why you're pausing for 5 minutes if you get a poison message. If you know it's bad why aren't you either throwing it away or passing it to a backout queue for further investigation? See JMS poison message handling:

http://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q032280_.htm

More concerning, why are you getting so many 'bad' messages?

0
votes

I know that with ActiveMQ you can tell the queue to wait 5 minutes before popping the same message again, with IBM MQ I dont have that possibility.

The option of retry interval between attempts need to be set on the MDB listener side, since it is acting as client. But not on WMQ side.

Is it possible to put failed messages to the back off the queue?

You wanted to place the message back on the queue or place the poisonous messages at the end of the same queue ? we can't move poison messages to the end of the same queue

There are only three options to handle poisonous messages:

  1. Place the message back on the queue
  2. re-route the message either to BOQ or DLQ
  3. Purge or discard it permanently.