users@glassfish.java.net

Re: Distributed Transactions trouble/questions

From: Steve Essery <Steve.Essery_at_Sun.COM>
Date: Tue, 20 Jan 2009 09:54:52 +0000

I think there is a fundamental restriction present, and mentioned in the
JMS 1.1 spec, section 8.5 (p 95/96), last two paragraphs:


It is important to note that a distributed transaction context does not
flow with
a message; that is, the receipt of the message cannot be part of the same
transaction that produced the message. This is the fundamental difference
between messaging and synchronized processing.

To reiterate, the act of producing and/or consuming messages in a
Session can
be transactional. The act of producing and consuming a specific message
across
different sessions cannot.


So while an MDB could receive a message, and persist that to a database
(and maybe send it to another broker as part of the same transaction),
the delivery of the message to a subsequent MDB is going to be part of a
new and separate transaction.

Alex Sherwin wrote:
> Trying to figure out exactly how to work distributed transactions that would
> cover the following:
>
> Jersey JAX-RS Web Service invocation, which sends a JMS Message, which is
> routed to 1 or more other servers, databases are updated. The other servers
> are all Glassfish, using OpenMQ.
>
> I'm trying to get a distributed transaction to cover all of the above, such
> that is somewhere along the chain of MDBs a failure occurs, that the whole
> thing unravels.
>
> I've tried this using CMT and BMT for the MDBs. When using BMT, various
> timings of UserTransaction.rollback() have been tried, throwing a
> RuntimeException, etc.
>
> I'm using the iBATIS DAO framework for managing my transactions in the web
> service invocation, which I'm using a JTA TransactionManager with the
> java:comp/UserTransaction.
>
> Am I missing something, or is this just not possible with what I'm trying to
> accomplish? If this is possible, what (in broad terms) is necessary, in
> terms of transaction configuration for the wrapping Web Service and the
> configuration of the MDBs?
>
> Something else I notice is that the web service invocation returns before
> all of the MDBs fire, so I find it hard to believe that they can be combined
> into a single transaction.
>
> I've read through all the blogs and specs I can find when searching for
> Distributed Transactions, JTA, and how the app server manages the
> javax.jms.Session, what properties its ignoring (ack mode, trasacted
> property etc), but I'm still very much unclear about the direct measures
> required to get what I need.
>
> Any thoughts?
>
>
>
> Alex Sherwin
> alex.sherwin_at_acadiasoft.com
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>