qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Qpid > The AMQP Distributed Transaction Classes (Java)
Date Fri, 05 Mar 2010 22:52:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=qpid&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/qpid/The+AMQP+Distributed+Transaction+Classes+%28Java%29">The
AMQP Distributed Transaction Classes (Java)</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~shuston">Steve
Huston</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <p>The distributed transaction classes provide support for the X-Open XA architecture.
The dtx-demarcation class is used to demarcate transaction boundaries on a given channel that
is subsequently used to perform AMQP native transactional work (produce publish messages).
Transaction coordination and recovery operations are provided by the dtx-coordination class.</p>

<p>A Transaction Manager uses RM Client XA interface to demarcate transaction boundaries
and coordinate transaction outcomes. RM Clients use the dtx-demarcation class to associate
transactional work with a transactional channel. The transactional channel is exposed to the
application driving the transaction. The application can then use the transactional channel
to transactionally produce and consume messages. RM clients use dtx-coordination to propagate
transaction outcomes and recovery operations to the AMQP broker. A second coordination channel
can be used for that purpose.</p>

<p>More details about can be found at:</p>
<ul class="alternate" type="square">
	<li><a href="https://wiki.108.redhat.com/wiki/index.php/AMQP:Transaction_SIG_dtx_XML"
rel="nofollow">https://wiki.108.redhat.com/wiki/index.php/AMQP:Transaction_SIG_dtx_XML</a></li>
	<li><a href="http://cwiki.apache.org/confluence/download/attachments/55787/dtx-classes-specification-document-v1.2.pdf"
rel="nofollow">http://cwiki.apache.org/confluence/download/attachments/55787/dtx-classes-specification-document-v1.2.pdf</a></li>
	<li><a href="http://cwiki.apache.org/confluence/download/attachments/55787/dtx-classes-presentation-v0.10-PMC-03142007.pdf"
rel="nofollow">http://cwiki.apache.org/confluence/download/attachments/55787/dtx-classes-presentation-v0.10-PMC-03142007.pdf</a></li>
</ul>


<h2><a name="TheAMQPDistributedTransactionClasses%28Java%29-TheQpidJavaImplementationinJava"></a>The
Qpid Java Implementation in Java</h2>
<p>As shown on the following class diagram, there are two protocol specific dtx classes,
that is to say DtxDemarcation and DtxCoordination that are highlighted in yellow.</p>

<p><img src="/confluence/download/attachments/55787/12358547_thumb_dtx.gif" align="absmiddle"
border="0" /></p>


<h3><a name="TheAMQPDistributedTransactionClasses%28Java%29-DtxDemarcation"></a>DtxDemarcation</h3>
<p>DtxDemarcation interacts with the corresponding AMQChannel. The operation select
creates the corresponding TransactionalContext (a channel has by default a non-transactional
context). The operations start and end associate and disassociate a provided xid with the
current TransactionalContext that percolates the call to the TransactionManager (operations
begin and end respectively). Note that the operation end is responsible for acknowledging
the messages against the context i.e. those messages are seen as being consumed under the
currently associated xid.</p>

<h3><a name="TheAMQPDistributedTransactionClasses%28Java%29-DtxCoordination"></a>DtxCoordination</h3>
<p>DtxCoordination directly interacts with the TransactionManager. Note that it is a
requirement that the operation end is called on all involved channels (i.e. all the acknowledged
messages have been specifically consumed under the provided xid).</p>

<h3><a name="TheAMQPDistributedTransactionClasses%28Java%29-TransactionalContext"></a>TransactionalContext</h3>
<p>There are three flavours of TransactionalContext: the non transactional one, the
local and distributed ones. The distributed and local contexts are very similar and both extend
the abstract context. Note that the distributed context does not implement commit and rollback
as this is DtxCoordination that is responsible for deciding of a transaction outcome.</p>

<h3><a name="TheAMQPDistributedTransactionClasses%28Java%29-TransactionManagerandMessageStore"></a>TransactionManager
and MessageStore</h3>
<p>Transaction manager and message store are linked as the message store may need to
add transaction records to the transaction identified by a given xid. Moreover, the transaction
manager may need to use the transactional facilities of the underlying store. This is the
case of the JDBCStore and JDBCTransactionManager. The JDBCTransactionManager uses the transaction
facilities of the JDBCStore for performing ACID operations during prepare and commit.</p>

<p>This is the responsibility of the MessageStore to recover queues and exchanges and
messages. Note that the JDBCTransactionManager delegates the responsibility of getting the
list of in-doubt transactions to the JDBCStore but another implementation of TransactionManager
may handle that directly.<br/>
The MessageStore implementation should not load the messages in memory during recovery but
only set the messageID. The message header, publish info and payload are lazily loaded. Note
that the message payloads are currently loaded in memory. We can however easily implement
a direct streaming of message payload on the wire (The MessageStore interface can be extended
for supporting that).</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/qpid/The+AMQP+Distributed+Transaction+Classes+%28Java%29">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=55787&revisedVersion=7&originalVersion=6">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/qpid/The+AMQP+Distributed+Transaction+Classes+%28Java%29?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message