transactionsibm-mqxms

MQ: What happens if a message rollback FAILED?


I use IBM.XMS (9.1.0.0) to get the message from the queue from my .NET application. Under the session, I get the message from the queue then insert into the database (SQL server), if one step failed, the session will roll back. The message will return to the queue so I can get it the next time. This works fine until one day, one message is lost and the MQ log said:

IBM.XMS.XMSException: CWSMQ0067E: Rollback failed. The Backout() operation on the underlying queue manager object failed.

Linked Exception : CompCode: 2, Reason: 2018

I'm not sure if this error is the cause, so my question is: what happens if "Rollback failed" exception appears, may the message return back to the queue or not?


Solution

  • In general: If you haven't committed your message, but not rolled back sucessfully either, the message will be rolled back automatically at some later point of time, when your session gets invalid. Regarding your specific case: MQRC 2018 indicates the connection handle is not valid. This might happen if the connection to the Queue Manager could not have been established, thus the handle to the connection is not valid, but you further want to proceed with an operation using this invalid handle. Such an operation includes invoking a roll back. You say, if one step failed, you invoke the rollback. Is obtaining the session to MQ part of these steps leading to a rollback? This would explain 2018. Don't attempt a rollback on a session which has not successfully been established. It is useless as there is nothing to rollback and it comes with 2018.