activemq-artemis/examples/features/standard/xa-receive
Martyn Taylor 90c9469701 [maven-release-plugin] prepare for next development iteration 2015-12-17 17:03:40 +00:00
..
src/main Add missing @Override annotations 2015-12-06 01:27:35 +02:00
pom.xml [maven-release-plugin] prepare for next development iteration 2015-12-17 17:03:40 +00:00
readme.html renaming broker-features -> features on examples 2015-08-13 00:11:56 -04:00

readme.html

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<html>
  <head>
    <title>ActiveMQ Artemis JMS XA Receive Example</title>
    <link rel="stylesheet" type="text/css" href="../../../common/common.css" />
    <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" />
    <script type="text/javascript" src="../../../common/prettify.js"></script>
  </head>
  <body onload="prettyPrint()">
     <h1>JMS XA Receive Example</h1>

     <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>


     <p>This example demonstrates receiving a message within the scope of an XA transaction. When using an XA transaction
         the message will only be acknowledged and removed from the queue when the transaction is committed.
     If the transaction is not committed the message maybe redelivered after rollback or during XA recovery.</p>

     <p>ActiveMQ Artemis is JTA aware, meaning you can use ActiveMQ Artemis in an XA transactional environment
     and participate in XA transactions. It provides the javax.transaction.xa.XAResource interface for that
     purpose. Users can get a XAConnectionFactory to create XAConnections and XASessions.</p>

     <p>In this example we simulate a transaction manager to control the transactions. First we create an XASession
      for receiving and a normal session for sending. Then we start a new xa transaction and enlist the receiving
      XASession through its XAResource. We then send two words, 'hello' and 'world', receive them, and let the
      transaction roll back. The received messages are cancelled back to the queue. Next we start
      a new transaction with the same XAResource enlisted, but this time we commit the transaction after receiving the
      messages. Then we check that no more messages are to be received.</p>
  </body>
</html>