activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [02/18] activemq-artemis git commit: ARTEMIS-180 removing -Pexample and some other improvements around the examples
Date Fri, 07 Aug 2015 19:31:21 GMT
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/transactional/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/transactional/pom.xml b/examples/jms/transactional/pom.xml
index 9029124..82bde8a 100644
--- a/examples/jms/transactional/pom.xml
+++ b/examples/jms/transactional/pom.xml
@@ -18,7 +18,8 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
 
    <parent>
@@ -27,7 +28,7 @@ under the License.
       <version>1.0.1-SNAPSHOT</version>
    </parent>
 
-   <artifactId>artemis-jms-transactional-example</artifactId>
+   <artifactId>transactional</artifactId>
    <packaging>jar</packaging>
    <name>ActiveMQ Artemis JMS Transactional Example</name>
 
@@ -37,71 +38,81 @@ under the License.
 
    <dependencies>
       <dependency>
-         <groupId>org.apache.geronimo.specs</groupId>
-         <artifactId>geronimo-jms_2.0_spec</artifactId>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-client</artifactId>
+         <version>${project.version}</version>
       </dependency>
    </dependencies>
 
    <profiles>
       <profile>
-         <id>example</id>
-         <build>
-            <plugins>
-               <plugin>
-                  <groupId>org.apache.activemq</groupId>
-                  <artifactId>artemis-maven-plugin</artifactId>
-                  <executions>
-                     <execution>
-                        <id>create</id>
-                        <goals>
-                           <goal>create</goal>
-                        </goals>
-                     </execution>
-                     <execution>
-                        <id>start</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <spawn>true</spawn>
-                           <testURI>tcp://localhost:61616</testURI>
-                           <args>
-                              <param>run</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>runClient</id>
-                        <goals>
-                           <goal>runClient</goal>
-                        </goals>
-                        <configuration>
-                           <clientClass>org.apache.activemq.artemis.jms.example.TransactionalExample</clientClass>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>stop</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <args>
-                              <param>stop</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                  </executions>
-                  <dependencies>
-                     <dependency>
-                        <groupId>org.apache.activemq.examples.jms</groupId>
-                        <artifactId>artemis-jms-transactional-example</artifactId>
-                        <version>${project.version}</version>
-                     </dependency>
-                  </dependencies>
-               </plugin>
-            </plugins>
-         </build>
+         <!-- specify -PnoServer if you don't want to start the server -->
+         <id>noServer</id>
+         <properties>
+            <noServer>true</noServer>
+         </properties>
       </profile>
    </profiles>
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.TransactionalExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.jms</groupId>
+                  <artifactId>transactional</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
 
 </project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/transactional/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/transactional/readme.html b/examples/jms/transactional/readme.html
index a7517c5..a988c27 100644
--- a/examples/jms/transactional/readme.html
+++ b/examples/jms/transactional/readme.html
@@ -27,122 +27,14 @@ under the License.
   <body onload="prettyPrint()">
      <h1>JMS Transactional Session 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 use a transacted Session with ActiveMQ Artemis.</p>
      <p>Firstly 2 messages are sent via the transacted sending session before being committed. This ensures that both message
      are sent</p>
      <p>Secondly the receiving session receives the messages firstly demonstrating a message being redelivered after the session
      being rolled back and then acknowledging receipt of the messages via the commit method.</p>
-    
-
-     <h2>Example step-by-step</h2>
-     <p><i>To run the example, simply type <code>mvn verify -Pexample</code> from this directory</i></p>
-
-     <ol>
-        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
-        <pre class="prettyprint">
-           <code>initialContext = getContext();</code>
-        </pre>
-
-        <li>We look-up the JMS queue object from JNDI</li>
-        <pre class="prettyprint">
-           <code>Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue");</code>
-        </pre>
-
-        <li>We look-up the JMS connection factory object from JNDI</li>
-        <pre class="prettyprint">
-           <code>ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");</code>
-        </pre>
-
-        <li>We create a JMS connection</li>
-        <pre class="prettyprint">
-           <code>connection = cf.createConnection();</code>
-        </pre>
-         
-        <li>We start the connection. In order for delivery to occur on any consumers or subscribers on a connection, the connection must be started</li>
-        <pre class="prettyprint">
-           <code>connection.start();</code>
-        </pre>
-         
-        <li>We create a JMS session. The session is created as transacted.</li>
-        <pre class="prettyprint">
-           <code>Session session = connection.createSession(true, Session.SESSION_TRANSACTED);</code>
-        </pre>
-
-        <li>We create a JMS message producer on the session. This will be used to send the messages.</li>
-	<pre class="prettyprint">
-	   <code>MessageProducer messageProducer = session.createProducer(queue);</code>
-        </pre>
-
-        <li>We create a message consumer</li>
-	<pre class="prettyprint">
-	   <code>MessageConsumer messageConsumer = session.createConsumer(queue);</code>
-        </pre>
-
-        <li>We create 2 text messages</li>
-	<pre class="prettyprint">
-           <code>TextMessage message1 = session.createTextMessage("This is a text message1");</code>
-           <code>TextMessage message2 = session.createTextMessage("This is a text message2");</code>
-        </pre>
-   
-        <li>We send the text messages to the queue</li>
-        <pre class="prettyprint">
-           <code>messageProducer.send(message1);</code>
-           <code>messageProducer.send(message2);</code>
-        </pre>
-
-        <li>We receive the message, it will return null as the transaction is not committed.</li>
-        <pre class="prettyprint">
-           <code>TextMessage receivedMessage = (TextMessage) messageConsumer.receive(5000);</code>
-        </pre>
-
-        <li>We commit the session</li>
-	<pre class="prettyprint">
-           <code>session.commit();</code>
-        </pre>
-         
-        <li>We receive the messages again</li>
-        <pre class="prettyprint">
-           <code>receivedMessage = (TextMessage) messageConsumer.receive(5000);</code>
-        </pre>
-
-        <li>We roll back the session, this will cause the received message canceled and redelivered again</li>
-        <pre class="prettyprint"> 
-           <code>session.rollback();</code>
-        </pre>
-
-        <li>We receive the message again, we will get two messages. Nothing more, nothing less</li>
-        <pre class="prettyprint"> 
-           <code>receivedMessage = (TextMessage) messageConsumer.receive(5000);</code>
-           <code>receivedMessage = (TextMessage) messageConsumer.receive(5000);</code>
-        </pre>
-
-        <li>We commit the session</li>
-        <pre class="prettyprint"> 
-           <code>session.commit();</code>
-        </pre>
-
-        <li>We receive the message again. Nothing should be received</li>
-        <pre class="prettyprint"> 
-           <code>receivedMessage = (TextMessage) messageConsumer.receive(5000);</code>
-        </pre>
-
-
-        <li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
 
-        <pre class="prettyprint">
-           <code>finally
-           {
-              if (initialContext != null)
-              {
-                initialContext.close();
-              }
-              if (connection != null)
-              {
-                 connection.close();
-              }
-           }</code>
-        </pre>
-         
-     </ol>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/xa-heuristic/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/xa-heuristic/pom.xml b/examples/jms/xa-heuristic/pom.xml
index ada7aaf..3ea0740 100644
--- a/examples/jms/xa-heuristic/pom.xml
+++ b/examples/jms/xa-heuristic/pom.xml
@@ -18,7 +18,8 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
 
    <parent>
@@ -27,7 +28,7 @@ under the License.
       <version>1.0.1-SNAPSHOT</version>
    </parent>
 
-   <artifactId>artemis-jms-xa-heuristic-example</artifactId>
+   <artifactId>xa-heuristic</artifactId>
    <packaging>jar</packaging>
    <name>ActiveMQ Artemis JMS XAHeuristicExample Example</name>
 
@@ -38,83 +39,83 @@ under the License.
    <dependencies>
       <dependency>
          <groupId>org.apache.activemq</groupId>
-         <artifactId>artemis-core-client</artifactId>
+         <artifactId>artemis-jms-client</artifactId>
          <version>${project.version}</version>
       </dependency>
-      <dependency>
-         <groupId>org.apache.activemq</groupId>
-         <artifactId>artemis-commons</artifactId>
-         <version>${project.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>org.apache.geronimo.specs</groupId>
-         <artifactId>geronimo-jms_2.0_spec</artifactId>
-      </dependency>
    </dependencies>
 
    <profiles>
       <profile>
-         <id>example</id>
-         <build>
-            <plugins>
-               <plugin>
-                  <groupId>org.apache.activemq</groupId>
-                  <artifactId>artemis-maven-plugin</artifactId>
-                  <executions>
-                     <execution>
-                        <id>create</id>
-                        <goals>
-                           <goal>create</goal>
-                        </goals>
-                        <configuration>
-                           <javaOptions>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false</javaOptions>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>start</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <spawn>true</spawn>
-                           <testURI>tcp://localhost:61616</testURI>
-                           <args>
-                              <param>run</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>runClient</id>
-                        <goals>
-                           <goal>runClient</goal>
-                        </goals>
-                        <configuration>
-                           <clientClass>org.apache.activemq.artemis.jms.example.XAHeuristicExample</clientClass>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>stop</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <args>
-                              <param>stop</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                  </executions>
-                  <dependencies>
-                     <dependency>
-                        <groupId>org.apache.activemq.examples.jms</groupId>
-                        <artifactId>artemis-jms-xa-heuristic-example</artifactId>
-                        <version>${project.version}</version>
-                     </dependency>
-                  </dependencies>
-               </plugin>
-            </plugins>
-         </build>
+         <!-- specify -PnoServer if you don't want to start the server -->
+         <id>noServer</id>
+         <properties>
+            <noServer>true</noServer>
+         </properties>
       </profile>
    </profiles>
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <javaOptions>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001
+                        -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
+                     </javaOptions>
+                     <ignore>${noServer}</ignore>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.XAHeuristicExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.jms</groupId>
+                  <artifactId>xa-heuristic</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
 
 </project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/xa-heuristic/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/xa-heuristic/readme.html b/examples/jms/xa-heuristic/readme.html
index 9ca84b0..c026def 100644
--- a/examples/jms/xa-heuristic/readme.html
+++ b/examples/jms/xa-heuristic/readme.html
@@ -26,222 +26,23 @@ under the License.
   </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 
+
+     <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 
+     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>
-     
-     <h2>Example step-by-step</h2>
-     <p><i>To run the example, simply type <code>mvn verify -Pexample</code> from this directory</i></p>
-     <ol>
-        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
-        <pre class="prettyprint">
-           <code>InitialContext initialContext = getContext(0);</code>
-        </pre>
-
-        <li>We look-up the JMS queue object from JNDI</li>
-        <pre class="prettyprint">
-           <code>Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue");</code>
-        </pre>
-
-        <li>We perform a lookup on the XA Connection Factory</li>
-        <pre class="prettyprint">
-           <code>XAConnectionFactory cf = (XAConnectionFactory) initialContext.lookup("/XAConnectionFactory");</code>
-        </pre>
-
-        <li>We create a JMS XAConnection</li>
-        <pre class="prettyprint">
-           <code>connection = cf.createXAConnection();</code>
-        </pre>
-
-        <li>We Start the connection</li>
-        <pre class="prettyprint">
-           <code>connection.start();</code>
-        </pre>
-
-        <li>We create a JMS XASession</li>
-        <pre class="prettyprint">
-          <code>XASession xaSession = connection.createXASession();</code>
-       </pre>
-
-        <li>We create a normal session</li>
-        <pre class="prettyprint">
-          <code>Session normalSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</code>
-       </pre>
-
-        <li>We create a normal Message Consumer</li>
-        <pre class="prettyprint">
-           <code>
-           MessageConsumer normalConsumer = normalSession.createConsumer(queue);
-           normalConsumer.setMessageListener(new SimpleMessageListener());
-           </code>
-       </pre>
-
-        <li>We get the JMS Session</li>
-        <pre class="prettyprint">
-          <code>Session session = xaSession.getSession();</code>
-       </pre>
-
-        <li>We create a message producer</li>
-        <pre class="prettyprint">
-          <code>MessageProducer producer = session.createProducer(queue); </code>
-       </pre>
-
-        <li>We create two Text Messages</li>
-        <pre class="prettyprint">
-          <code>
-          TextMessage helloMessage = session.createTextMessage("hello");
-          TextMessage worldMessage = session.createTextMessage("world");
-          </code>
-       </pre>
-
-        <li>We create a transaction</li>
-        <pre class="prettyprint">
-          <code>Xid xid1 = new XidImpl("xa-example1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());</code>
-       </pre>
-
-        <li>We get the JMS XAResource</li>
-        <pre class="prettyprint">
-          <code>XAResource xaRes = xaSession.getXAResource();</code>
-       </pre>
-
-        <li>We begin the Transaction work</li>
-        <pre class="prettyprint">
-          <code>xaRes.start(xid1, XAResource.TMNOFLAGS);</code>
-       </pre>
-
-        <li>We do work, sending hello message.</li>
-        <pre class="prettyprint">
-          <code>
-          normalProducer.send(helloMessage);
-          </code>
-       </pre>
-
-        <li>We stop the work for xid1</li>
-        <pre class="prettyprint">
-          <code>xaRes.end(xid1, XAResource.TMSUCCESS);</code>
-       </pre>
-
-        <li>We prepare xid1</li>
-        <pre class="prettyprint">
-          <code>xaRes.prepare(xid1);</code>
-       </pre>
-
-        <li>We check the none should be received.</li>
-        <pre class="prettyprint">
-          <code>checkNoMessageReceived();</code>
-       </pre>
-
-        <li>We create another transaction </li>
-        <pre class="prettyprint">
-          <code>Xid xid2 = new XidImpl("xa-example2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());</code>
-       </pre>
-
-        <li>We begin the transaction work</li>
-        <pre class="prettyprint">
-          <code>xaRes.start(xid2, XAResource.TMNOFLAGS);</code>
-       </pre>
-
-        <li>We send the second message</li>
-        <pre class="prettyprint">
-           <code>producer.send(worldMessage);</code>
-       </pre>
-
-        <li>We stop the work for xid2</li>
-        <pre class="prettyprint">
-          <code>xaRes.end(xid2, XAResource.TMSUCCESS);</code>
-       </pre>
-
-        <li>We prepare xid2</li>
-        <pre class="prettyprint">
-          <code>xaRes.prepare(xid2);</code>
-       </pre>
-
-       <li>Again, no messages should be received!</li>
-       <pre class="prettyprint">
-          <code>checkNoMessageReceived();</code>
-       </pre>
-
-        <li>We create JMX Connector to connect to the server's MBeanServer.</li>
-        <pre class="prettyprint">
-          <code>
-          JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, String>());
-          </code>
-       </pre>
-
-        <li>We retrieve the MBeanServerConnection</li>
-        <pre class="prettyprint">
-          <code>MBeanServerConnection mbsc = connector.getMBeanServerConnection();</code>
-       </pre>
-
-        <li>We list the prepared transactions</li>
-        <pre class="prettyprint">
-          <code>
-          ObjectName serverObject = ObjectNameBuilder.DEFAULT.getMessagingServerObjectName();
-          String[] infos = (String[])mbsc.invoke(serverObject, "listPreparedTransactions", null, null);
-         
-          System.out.println("Prepared transactions: ");
-          for (String i : infos)
-          {
-             System.out.println(i);
-          }
-          </code>
-       </pre>
-
-        <li>We roll back the first transaction</li>
-        <pre class="prettyprint">
-          <code>mbsc.invoke(serverObject, "rollbackPreparedTransaction", new String[] {XidImpl.toBase64String(xid1)}, new String[]{"java.lang.String"});</code>
-       </pre>
-
-        <li>We commit the second one</li>
-        <pre class="prettyprint">
-          <code>mbsc.invoke(serverObject, "commitPreparedTransaction", new String[] {XidImpl.toBase64String(xid2)}, new String[]{"java.lang.String"});</code>
-       </pre>
-
-        <li>We check the result, only the 'world' message received</li>
-        <pre class="prettyprint">
-          <code>checkMessageReceived("world");</code>
-       </pre>
-
-        <li>We check the prepared transaction again, should have none.</li>
-        <pre class="prettyprint">
-          <code>
-          infos = (String[])mbsc.invoke(serverObject, "listPreparedTransactions", null, null);
-          System.out.println("No. of prepared transactions now: " + infos.length);
-          </code>
-       </pre>
-
-        <li>We close the JMX connector.</li>
-        <pre class="prettyprint">
-          <code>connector.close();</code>
-       </pre>
-       
-        <li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
-
-        <pre class="prettyprint">
-           <code>finally
-           {
-              if (initialContext != null)
-              {
-                initialContext.close();
-              }
-              if (connection != null)
-              {
-                 connection.close();
-              }
-           }</code>
-        </pre>
-     </ol>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/xa-receive/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/xa-receive/pom.xml b/examples/jms/xa-receive/pom.xml
index 8336c5f..c7b7da8 100644
--- a/examples/jms/xa-receive/pom.xml
+++ b/examples/jms/xa-receive/pom.xml
@@ -18,7 +18,8 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
 
    <parent>
@@ -27,7 +28,7 @@ under the License.
       <version>1.0.1-SNAPSHOT</version>
    </parent>
 
-   <artifactId>artemis-jms-xa-receive-example</artifactId>
+   <artifactId>xa-receive</artifactId>
    <packaging>jar</packaging>
    <name>ActiveMQ Artemis JMS XA Receive Example</name>
 
@@ -38,76 +39,80 @@ under the License.
    <dependencies>
       <dependency>
          <groupId>org.apache.activemq</groupId>
-         <artifactId>artemis-commons</artifactId>
+         <artifactId>artemis-jms-client</artifactId>
          <version>${project.version}</version>
       </dependency>
-      <dependency>
-         <groupId>org.apache.geronimo.specs</groupId>
-         <artifactId>geronimo-jms_2.0_spec</artifactId>
-      </dependency>
    </dependencies>
 
    <profiles>
       <profile>
-         <id>example</id>
-         <build>
-            <plugins>
-               <plugin>
-                  <groupId>org.apache.activemq</groupId>
-                  <artifactId>artemis-maven-plugin</artifactId>
-                  <executions>
-                     <execution>
-                        <id>create</id>
-                        <goals>
-                           <goal>create</goal>
-                        </goals>
-                     </execution>
-                     <execution>
-                        <id>start</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <spawn>true</spawn>
-                           <testURI>tcp://localhost:61616</testURI>
-                           <args>
-                              <param>run</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>runClient</id>
-                        <goals>
-                           <goal>runClient</goal>
-                        </goals>
-                        <configuration>
-                           <clientClass>org.apache.activemq.artemis.jms.example.XAReceiveExample</clientClass>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>stop</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <args>
-                              <param>stop</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                  </executions>
-                  <dependencies>
-                     <dependency>
-                        <groupId>org.apache.activemq.examples.jms</groupId>
-                        <artifactId>artemis-jms-xa-receive-example</artifactId>
-                        <version>${project.version}</version>
-                     </dependency>
-                  </dependencies>
-               </plugin>
-            </plugins>
-         </build>
+         <!-- specify -PnoServer if you don't want to start the server -->
+         <id>noServer</id>
+         <properties>
+            <noServer>true</noServer>
+         </properties>
       </profile>
    </profiles>
-
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.XAReceiveExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.jms</groupId>
+                  <artifactId>xa-receive</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
 
 </project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/xa-receive/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/xa-receive/readme.html b/examples/jms/xa-receive/readme.html
index 0d24cde..47f2fef 100644
--- a/examples/jms/xa-receive/readme.html
+++ b/examples/jms/xa-receive/readme.html
@@ -26,197 +26,23 @@ under the License.
   </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 
+      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 
+      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>
-
-     <h2>Example step-by-step</h2>
-     <p><i>To run the example, simply type <code>mvn verify -Pexample</code> from this directory</i></p>
-     <ol>
-        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
-        <pre class="prettyprint">
-           <code>InitialContext initialContext = getContext(0);</code>
-        </pre>
-
-        <li>We look-up the JMS queue object from JNDI</li>
-        <pre class="prettyprint">
-           <code>Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue");</code>
-        </pre>
-
-        <li>We perform a lookup on the XA Connection Factory</li>
-        <pre class="prettyprint">
-           <code>XAConnectionFactory cf = (XAConnectionFactory) initialContext.lookup("/XAConnectionFactory");</code>
-        </pre>
-
-        <li>We create a JMS XAConnection</li>
-        <pre class="prettyprint">
-           <code>connection = cf.createXAConnection();</code>
-        </pre>
-
-        <li>We Start the connection</li>
-        <pre class="prettyprint">
-           <code>connection.start();</code>
-        </pre>
-
-        <li>We create a JMS XASession</li>
-        <pre class="prettyprint">
-          <code>XASession xaSession = connection.createXASession();</code>
-       </pre>
-
-        <li>We create a normal session</li>
-        <pre class="prettyprint">
-          <code>Session normalSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</code>
-       </pre>
-
-        <li>We create a normal Message Producer</li>
-        <pre class="prettyprint">
-           <code>
-           MessageProducer normalProducer = normalSession.createProducer(queue);
-           </code>
-       </pre>
-
-        <li>We get the JMS Session</li>
-        <pre class="prettyprint">
-          <code>Session session = xaSession.getSession();</code>
-       </pre>
-
-        <li>We create a message consumer</li>
-        <pre class="prettyprint">
-          <code>MessageConsumer xaConsumer = session.createConsumer(queue); </code>
-       </pre>
-
-        <li>We create two Text Messages</li>
-        <pre class="prettyprint">
-          <code>
-          TextMessage helloMessage = session.createTextMessage("hello");
-          TextMessage worldMessage = session.createTextMessage("world");
-          </code>
-       </pre>
-
-        <li>We create a transaction</li>
-        <pre class="prettyprint">
-          <code>Xid xid1 = new XidImpl("xa-example1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());</code>
-       </pre>
-
-        <li>We get the JMS XAResource</li>
-        <pre class="prettyprint">
-          <code>XAResource xaRes = xaSession.getXAResource();</code>
-       </pre>
-
-        <li>We begin the Transaction work</li>
-        <pre class="prettyprint">
-          <code>xaRes.start(xid1, XAResource.TMNOFLAGS);</code>
-       </pre>
-
-        <li>We send two messages.</li>
-        <pre class="prettyprint">
-          <code>
-         normalProducer.send(helloMessage);
-         normalProducer.send(worldMessage);
-          </code>
-       </pre>
-
-        <li>We receive the messages</li>
-        <pre class="prettyprint">
-          <code>
-          TextMessage rm1 = (TextMessage)xaConsumer.receive();
-          System.out.println("Message received: " + rm1.getText());
-          TextMessage rm2 = (TextMessage)xaConsumer.receive();
-          System.out.println("Message received: " + rm2.getText());
-          </code>
-       </pre>
-
-        <li>We stop the work</li>
-        <pre class="prettyprint">
-          <code>xaRes.end(xid1, XAResource.TMSUCCESS);</code>
-       </pre>
-
-        <li>We prepare</li>
-        <pre class="prettyprint">
-          <code>xaRes.prepare(xid1);</code>
-       </pre>
-
-        <li>We roll back the transaction </li>
-        <pre class="prettyprint">
-          <code>xaRes.rollback(xid1);</code>
-       </pre>
-
-        <li>We create another transaction </li>
-        <pre class="prettyprint">
-          <code>Xid xid2 = new XidImpl("xa-example2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());</code>
-       </pre>
-
-        <li>We start the transaction</li>
-        <pre class="prettyprint">
-          <code>xaRes.start(xid2, XAResource.TMNOFLAGS);</code>
-       </pre>
-
-        <li>We receive those messages again</li>
-        <pre class="prettyprint">
-           <code>
-           rm1 = (TextMessage)xaConsumer.receive();
-           System.out.println("Message received again: " + rm1.getText());
-           rm2 = (TextMessage)xaConsumer.receive();
-           System.out.println("Message received again: " + rm2.getText());
-            </code>
-       </pre>
-
-        <li>We stop the work</li>
-        <pre class="prettyprint">
-          <code>xaRes.end(xid2, XAResource.TMSUCCESS);</code>
-       </pre>
-
-        <li>We prepare</li>
-        <pre class="prettyprint">
-          <code>xaRes.prepare(xid2);</code>
-       </pre>
-
-       <li>We commit!</li>
-       <pre class="prettyprint">
-          <code>xaRes.commit(xid2, false);</code>
-       </pre>
-
-        <li>We check that no more messages are received.</li>
-        <pre class="prettyprint">
-          <code>
-          TextMessage rm3 = (TextMessage)xaConsumer.receive(2000);
-          if (rm3 == null)
-          {
-             System.out.println("No message received after commit.");
-          }
-          else
-          {
-             result = false;
-          }
-          </code>
-       </pre>
-
-        <li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
-
-        <pre class="prettyprint">
-           <code>finally
-           {
-              if (initialContext != null)
-              {
-                initialContext.close();
-              }
-              if (connection != null)
-              {
-                 connection.close();
-              }
-           }</code>
-        </pre>
-     </ol>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/xa-send/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/xa-send/pom.xml b/examples/jms/xa-send/pom.xml
index 3038202..cc6ab8f 100644
--- a/examples/jms/xa-send/pom.xml
+++ b/examples/jms/xa-send/pom.xml
@@ -18,7 +18,8 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
 
    <parent>
@@ -27,7 +28,7 @@ under the License.
       <version>1.0.1-SNAPSHOT</version>
    </parent>
 
-   <artifactId>artemis-jms-xa-send-example</artifactId>
+   <artifactId>xa-send</artifactId>
    <packaging>jar</packaging>
    <name>ActiveMQ Artemis JMS XA Send Example</name>
 
@@ -38,74 +39,80 @@ under the License.
    <dependencies>
       <dependency>
          <groupId>org.apache.activemq</groupId>
-         <artifactId>artemis-commons</artifactId>
+         <artifactId>artemis-jms-client</artifactId>
          <version>${project.version}</version>
       </dependency>
-      <dependency>
-         <groupId>org.apache.geronimo.specs</groupId>
-         <artifactId>geronimo-jms_2.0_spec</artifactId>
-      </dependency>
    </dependencies>
 
    <profiles>
       <profile>
-         <id>example</id>
-         <build>
-            <plugins>
-               <plugin>
-                  <groupId>org.apache.activemq</groupId>
-                  <artifactId>artemis-maven-plugin</artifactId>
-                  <executions>
-                     <execution>
-                        <id>create</id>
-                        <goals>
-                           <goal>create</goal>
-                        </goals>
-                     </execution>
-                     <execution>
-                        <id>start</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <spawn>true</spawn>
-                           <testURI>tcp://localhost:61616</testURI>
-                           <args>
-                              <param>run</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>runClient</id>
-                        <goals>
-                           <goal>runClient</goal>
-                        </goals>
-                        <configuration>
-                           <clientClass>org.apache.activemq.artemis.jms.example.XASendExample</clientClass>
-                        </configuration>
-                     </execution>
-                     <execution>
-                        <id>stop</id>
-                        <goals>
-                           <goal>cli</goal>
-                        </goals>
-                        <configuration>
-                           <args>
-                              <param>stop</param>
-                           </args>
-                        </configuration>
-                     </execution>
-                  </executions>
-                  <dependencies>
-                     <dependency>
-                        <groupId>org.apache.activemq.examples.jms</groupId>
-                        <artifactId>artemis-jms-xa-send-example</artifactId>
-                        <version>${project.version}</version>
-                     </dependency>
-                  </dependencies>
-               </plugin>
-            </plugins>
-         </build>
+         <!-- specify -PnoServer if you don't want to start the server -->
+         <id>noServer</id>
+         <properties>
+            <noServer>true</noServer>
+         </properties>
       </profile>
    </profiles>
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.XASendExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.jms</groupId>
+                  <artifactId>xa-send</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 1371354..456023a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -60,6 +60,7 @@ under the License.
       </pluginRepository>
    </pluginRepositories>
 
+   <!-- You need to activate -Pexamples to run all the examples -->
    <modules>
       <module>core</module>
       <module>jms</module>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 28d48ef..f11c018 100644
--- a/pom.xml
+++ b/pom.xml
@@ -563,7 +563,6 @@
             <module>integration/activemq-spring-integration</module>
             <module>integration/activemq-aerogear-integration</module>
             <module>integration/activemq-vertx-integration</module>
-            <module>examples</module>
             <module>tests</module>
             <module>artemis-distribution</module>
          </modules>


Mime
View raw message