This will require a fair amount of work because of the way we allocate Sessions.
IMO, we are doing this incorrectly:
Because we defer allocating a resource with the CM until *after* the connection has been created we don't enlist in a Txn until the client calls
createSession(true | false, ackMode)
When we create the underlying ManagedConnection, we also allocate the physical Sesssion in the setup() method. Because of this, by the time we enlist the LocalXAResource, the Session has alredy been created. If the user calls:
createSession(false, Session.AutoAcknowledge)
we essentially ignore all transaction lifecycle events because we are taking the transacted flag from the createSession method as a boolean to control local transaction behavior (see JmsLocalTransaction).
This flag should really be ignored as it has no bearing in CMT because we are managing this for the client.
One way to fix this would be
1) Don't allocate the physical Session in the setup() method
2) When a LocalTransaction is started, in the
getSession()
createSession(true | false, ackMode)