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()
|
method create a transacted Session and set a flag to say 'in transaction'. Note,
we will also have to account for the no-tx-connection-factory deployment to actually take
the flags from the CRI into account in the case the client wants to control the
transaction. A different getSession() method for the JmsLocalTransaction will probably do
the trick.
3) Set the state variable on transaction completion.
The other approach would be to rework the JmsConnectionFactory to allocate a real
connection handle for the Connection. On enlistment we create a transacted Session which
ultimately gets returned to the user on the
| createSession(true | false, ackMode)
|
call.
As the JIRA task mentions, this is not a trivial change but IMO we pretty much have to do
this as I don't think the using the transact flag as a way to control transaction
behavior in CMT is correct.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040575#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...