Hello,
we are using JMS to receive messages from an IBM MQ. We are receiving messages asynchronously via a JmsListener and process them, sometimes by sending other messages via a JmsTemplate and sometimes by doing JPA operations.
However, it is conceivable that our data source is unavailable temporarily, in which case our database accesses fail. It is one of our requirements however that we process all messages. In case of a database error, the message should be moved to a backout queue. To this end, we have set BOTHRESH and BOQNAME on our input queue.
If we process a message which, during processing, generates a JPA related exception (Constraint Violation for instance), our code passes that exception on to the JmsListener that services the input queue. After BOTHRESH attempts, our message is moved to the backout queue. There is a caveat, however, and that is that the message does not seem to be committed.
In our case, MQ Explorer will show that the length of our backout queue is greater than zero, browsing the messages in the queue will show an empty list of messages. MQ Explorer also shows that the backout queue has uncommitted messages. My expectation would be that any message that is moved to the backout queue is fully committed when it is moved there. When our application shuts down, the count of messages in the backout queue decreases by one and the count of messages in the input queue increases by one, for each uncommitted message.
IBM MQ documentation says that the removal to a backout queue, when handling messages asynchronously. is handled in an unrelated unit of work, which I interpret to mean that a developer has no means to manually commit a backout message to it's queue.
It is often mentioned that the fix is to add defaultListenerContainerFactory.setSessionTransacted(true) to the bean that instantiates our listener container. Doing this did not yield any progress.
I don't believe this is expected behavior, which is why I am filing this bug.
Thank you!
Hello,
we are using JMS to receive messages from an IBM MQ. We are receiving messages asynchronously via a
JmsListenerand process them, sometimes by sending other messages via aJmsTemplateand sometimes by doing JPA operations.However, it is conceivable that our data source is unavailable temporarily, in which case our database accesses fail. It is one of our requirements however that we process all messages. In case of a database error, the message should be moved to a backout queue. To this end, we have set
BOTHRESHandBOQNAMEon our input queue.If we process a message which, during processing, generates a JPA related exception (Constraint Violation for instance), our code passes that exception on to the
JmsListenerthat services the input queue. AfterBOTHRESHattempts, our message is moved to the backout queue. There is a caveat, however, and that is that the message does not seem to be committed.In our case, MQ Explorer will show that the length of our backout queue is greater than zero, browsing the messages in the queue will show an empty list of messages. MQ Explorer also shows that the backout queue has uncommitted messages. My expectation would be that any message that is moved to the backout queue is fully committed when it is moved there. When our application shuts down, the count of messages in the backout queue decreases by one and the count of messages in the input queue increases by one, for each uncommitted message.
IBM MQ documentation says that the removal to a backout queue, when handling messages asynchronously. is handled in an unrelated unit of work, which I interpret to mean that a developer has no means to manually commit a backout message to it's queue.
It is often mentioned that the fix is to add
defaultListenerContainerFactory.setSessionTransacted(true)to the bean that instantiates our listener container. Doing this did not yield any progress.I don't believe this is expected behavior, which is why I am filing this bug.
Thank you!