activemq-artemis/examples/features/standard/xa-heuristic/readme.html

49 lines
2.5 KiB
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 Heuristic 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 Heuristic 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 shows you how to make an XA heuristic decision through the ActiveMQ Artemis Management Interface.</p>
<p>A heuristic decision is a unilateral decision to commit or rollback an XA transaction branch after it has
been prepared. </p>
<p>In this example we simulate a transaction manager to control the transactions. First we create an XASession
and enlist it in a transaction through its XAResource. We then send a text message, 'hello' and end/prepare the transaction
on the XAResource, but neither commit nor roll back the transaction. Another transaction is created and
associated with the same XAResource, and a second message, 'world' is sent on behalf of the second transaction. Again we leave
the second transaction in prepare state.
Then we get the MBeanServerConnection object to manipulate the prepared transactions. To illustrate, we roll back the first
transaction but commit the second. This will result in that only the message 'world' is received. </p>
<p>This example uses JMX to manipulate transactions in a ActiveMQ Artemis Server. For details on JMX facilities with ActiveMQ Artemis,
please look at the JMX Example.</p>
</body>
</html>