Search code examples
javaspringspring-jmsopenmq

Message is lost after time out in OpenMQ


I have a system were we use OpenMQ. I'm noticing that sometimes we receive this error from a consumer:

WARN  org.springframework.jms.listener.DefaultMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'Sun Java System MQ Destination
getName():      xxMessageNamexx
Class:          com.sun.messaging.Queue
getVERSION():       3.0
isReadonly():       false
getProperties():    {imqDestinationName=xxDestinationNamexx, imqDestinationDescription=A Description for the Destination Object}' - trying to recover. Cause: [C4000]: Packet acknowledge failed. user=guest, broker=xxx:5555(55385)
com.sun.messaging.jms.JMSException: [C4000]: Packet acknowledge failed. user=guest, broker=xxx:5555(55385)

Also, that message is lost and is no longer in the queue.

I know I can fix this by increasing imqAckTimeout but I'm wondering if we have a timeout issue, why the message gets deleted from the queue?

I'm new to the message queue so please let me know what information I can provide that can help fixing the issue?


Solution

  • Well, this answer explains everything to me now https://stackoverflow.com/a/9886168/3314116.

    It seems that using AUTO_ACKNOWLEDGE mode in AbstractMessageListenerContainer lets the messages get acknowledged before message consumption. The best option for me I guess is to use transactions