Transactional behavior
Messages sent and received by the IBM® MQ classes for JMS in an IMS environment are always associated with the IMS unit of work (UOW) that is active on the current task.
That UOW can only be completed by calling the commit or rollback methods on an instance of the
com.ibm.ims.dli.tm.Transaction
object, or by the IMS task ending normally in which case the UOW is implicitly
committed. If the IMS task ends abnormally, the UOW
is rolled back.
As a result of this, the values of the transacted and
acknowledgeMode arguments are ignored when calling any of the
Connection.createSession
, or ConnectionFactory.createContext
methods. Additionally the following methods are not supported. Calling any of the following methods
results in an IllegalStateException
in the session case:-
javax.jms.Session.commit()
-
javax.jms.Session.recover()
-
javax.jms.Session.rollback()
IllegalStateRuntimeSession
in the JMS context case:-
javax.jms.JMSContext.commit()
-
javax.jms.JMSContext.recover()
-
javax.jms.JMSContext.rollback()
There is one exception to this behavior. If a session or JMS context is created using one of the following mechanisms:
-
Connection.createSession(false, Session.AUTO_ACKNOWLEDGE)
-
Connection.createSession(Session.AUTO_ACKNOWLEDGE)
-
ConnectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE)
- Any messages sent, are sent outside of the IMS UOW. That is, they will be available on the target destination immediately, or when the provided delivery delay interval has completed.
- Any non-persistent messages will be received outside of the IMS UOW, unless the SYNCPOINTALLGETS property has been specified on the connection factory that created the session or JMS context.
- Persistent messages will always be received inside the IMS UOW.
This might be useful if, for example, you want to write an audit message to a queue even if the UOW rolls back.