The problem we have is this:
In the case of an MDB, the message is consumed from the underlying JMS provider *before*
the MDB container has a chance to enlist the session in a global tx (this is the old
design problem with ASF).
So the XASession needs to behave like a local transacted session if it is not enlisted in
a global tx, otherwise, if it behaved like auto ack it would get acked immediately, then,
some time later the onMessage gets called which is implemented by the StdServerSession
which enlists the XASession in the global tx, at which point we _convert_ the work done
previously in the local tx into the global tx.
So this is fine for the MDB case - the case where the session was created by the
StdServerSessionPool.
However if the XASession wasn't created via the SessionPool - i.e. it's not a
session for a transacted MDB, then we don't want it to fall back to behaving like a
local transacted session, we want it to behave like auto_ack.
E.g. If in a method of an EJB, I use the JCA MCF to create a connection, session, then
send a message, but no global tx is present, we want the message to be sent immediately -
i.e. we want the XASession to behave non transactionally.
Also, in the same EJB method, we use the JCA MCF to create a connection, session,
consumer, consume a message, then we want that message to get acked - i.e. the session to
behave non transactionally.
This is the behaviour JBoss MQ has.
So, basicaly the session needs to behave differently depending on whether it was created
via a session pool or not. But the problem is how to signal that to the session - I
can't see how to do that.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041135#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...