http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml index 9173c64..9b89d80 100644 --- a/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <cluster-user>exampleUser</cluster-user>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-failback/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-failback/pom.xml b/examples/jms/replicated-failback/pom.xml index d9c5150..9cfdbc5 100644 --- a/examples/jms/replicated-failback/pom.xml +++ b/examples/jms/replicated-failback/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-replicated-failback-example</artifactId> + <artifactId>replicated-failback</artifactId> <packaging>jar</packaging> <name>ActiveMQ Artemis JMS Replicated Failback Example</name> @@ -47,61 +48,56 @@ under the License. </dependency> </dependencies> - <profiles> - <profile> - <id>example</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-maven-plugin</artifactId> - <executions> - <execution> - <id>create0</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server0</instance> - <configuration>${basedir}/target/classes/activemq/server0</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>create1</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server1</instance> - <configuration>${basedir}/target/classes/activemq/server1</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.ReplicatedFailbackExample</clientClass> - <args> - <param>${basedir}/target/server0</param> - <param>${basedir}/target/server1</param> - </args> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.activemq.examples.jms</groupId> - <artifactId>artemis-jms-replicated-failback-example</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> - </profiles> + <build> + <plugins> + <plugin> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-maven-plugin</artifactId> + <executions> + <execution> + <id>create0</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server0</instance> + <configuration>${basedir}/target/classes/activemq/server0</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>create1</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server1</instance> + <configuration>${basedir}/target/classes/activemq/server1</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>runClient</id> + <goals> + <goal>runClient</goal> + </goals> + <configuration> + <clientClass>org.apache.activemq.artemis.jms.example.ReplicatedFailbackExample</clientClass> + <args> + <param>${basedir}/target/server0</param> + <param>${basedir}/target/server1</param> + </args> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.activemq.examples.jms</groupId> + <artifactId>replicated-failback</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/replicated-failback/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-failback/readme.html b/examples/jms/replicated-failback/readme.html index c42eaa1..aaf90eb 100644 --- a/examples/jms/replicated-failback/readme.html +++ b/examples/jms/replicated-failback/readme.html @@ -27,146 +27,12 @@ under the License. <body onload="prettyPrint()"> <h1>JMS Multiple Failover using Replication Example</h1> - <b>Note that failback example is not working in 2.3.0.Alpha but will be fully functional in the next release.</b> - + <pre>To run the example, simply type <b>mvn verify</b> from this directory.</pre> + <p>This example demonstrates three servers coupled as a live-backup-backup group for high availability (HA) using replication, and a client connection failing over from live to backup when the live server is crashed and then to the second backup once the new live fails.</p> <p>For more information on ActiveMQ Artemis failover and HA, and clustering in general, please see the clustering section of the user manual.</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> - <p>In this example, the live server is server 1, and the backup server is server 0</p> - <p>The connection will initially be created to server1, server 1 will crash, and the client will carry on - seamlessly on server 0, the backup server.</p> - - <ol> - <li>Get an initial context for looking up JNDI from server #0.</li> - <pre class="prettyprint"> - initialContext = getContext(0); - </pre> - - <li>Look up the JMS resources from JNDI on server #0.</li> - <pre class="prettyprint"> - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); - </pre> - - <li>Create a JMS Connection</li> - <pre class="prettyprint"> - connection = connectionFactory.createConnection(); - </pre> - - <li>Create a client acknowledged Session</li> - <pre class="prettyprint"> - Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); - </pre> - - <li>Start the connection to ensure delivery occurs</li> - <pre class="prettyprint"> - connection.start(); - </pre> - - <li>Create a JMS MessageProducer</li> - <pre class="prettyprint"> - MessageProducer producer = session.createProducer(queue); - </pre> - - <li>Create a JMS MessageConsumer</li> - <pre class="prettyprint"> - MessageConsumer consumer = session.createConsumer(queue); - </pre> - - <li>Send some messages to server #0, the live server</li> - <pre class="prettyprint"> - for (int i = 0; i < numMessages; i++) - { - TextMessage message = session.createTextMessage("This is text message " + i); - producer.send(message); - System.out.println("Sent message: " + message.getText()); - } - </pre> - - <li>Receive and acknowledge a third of the sent messages</li> - <pre class="prettyprint"> - TextMessage message0 = null; - for (int i = 0; i < numMessages / 3; i++) - { - message0 = (TextMessage)consumer.receive(5000); - System.out.println("Got message: " + message0.getText()); - } - message0.acknowledge(); - </pre> - - <p>When server #0 crashes, the client automatically detects the failure and automatically - fails over from server #0 to server #1 (in your real program you wouldn't need to sleep). - </p> - - <li>Acknowledging the 2nd third of the sent messages will fail as failover to the backup server has occurred</li> - <pre class="prettyprint"> - try - { - message0.acknowledge(); - } - catch (JMSException e) - { - System.err.println("Got exception while acknowledging message: " + e.getMessage()); - } - </pre> - - <li>Consume again the 2nd third of the messages again. Note that they are not considered as redelivered.</li> - <pre class="prettyprint"> - for (int i = numMessages / 3; i < (numMessages / 3) * 2; i++) - { - message0 = (TextMessage)consumer.receive(5000); - System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered()); - } - message0.acknowledge(); - </pre> - - <p>now we Kill server #1 and wait for the server #2 to take over the responsibilities.</p> - - <li>Acknowledging the 3rd third of the sent messages will fail as failover to the backup server has occurred</li> - <pre class="prettyprint"> - try - { - message0.acknowledge(); - } - catch (JMSException e) - { - System.err.println("Got exception while acknowledging message: " + e.getMessage()); - } - </pre> - - - <li>Consume again the 3rd third of the messages again. Note that they are not considered as redelivered</li> - <pre class="prettyprint"> - for (int i = (numMessages / 3) * 2; i < numMessages; i++) - { - message0 = (TextMessage)consumer.receive(5000); - System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered()); - } - message0.acknowledge(); - </pre> - - <li>And finally, <strong>always</strong> remember to close your 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"> - finally - { - if (connection != null) - { - connection.close(); - } - - if (initialContext != null) - { - initialContext.close(); - } - } - </pre> - - </ol> </body> </html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml b/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml index ab85a38..c7f4783 100644 --- a/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <cluster-user>exampleUser</cluster-user> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml index cfb7e33..da5a656 100644 --- a/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <cluster-user>exampleUser</cluster-user> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-multiple-failover/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-multiple-failover/pom.xml b/examples/jms/replicated-multiple-failover/pom.xml index d1af812..bd9a44c 100644 --- a/examples/jms/replicated-multiple-failover/pom.xml +++ b/examples/jms/replicated-multiple-failover/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-replicated-multiple-failover-example</artifactId> + <artifactId>replicated-multiple-failover</artifactId> <packaging>jar</packaging> <name>ActiveMQ Artemis JMS Replicated Multiple Failover Example</name> @@ -42,79 +43,76 @@ under the License. <version>${project.version}</version> </dependency> <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>create0</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server0</instance> - <configuration>${basedir}/target/classes/activemq/server0</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>create1</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server1</instance> - <configuration>${basedir}/target/classes/activemq/server1</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>create2</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server2</instance> - <configuration>${basedir}/target/classes/activemq/server2</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.ReplicatedMultipleFailoverExample</clientClass> - <args> - <param>${basedir}/target/server0</param> - <param>${basedir}/target/server1</param> - <param>${basedir}/target/server2</param> - </args> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.activemq.examples.jms</groupId> - <artifactId>artemis-jms-replicated-multiple-failover-example</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> - </profiles> + <build> + <plugins> + <plugin> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-maven-plugin</artifactId> + <executions> + <execution> + <id>create0</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server0</instance> + <configuration>${basedir}/target/classes/activemq/server0</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>create1</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server1</instance> + <configuration>${basedir}/target/classes/activemq/server1</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>create2</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server2</instance> + <configuration>${basedir}/target/classes/activemq/server2</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>runClient</id> + <goals> + <goal>runClient</goal> + </goals> + <configuration> + <clientClass>org.apache.activemq.artemis.jms.example.ReplicatedMultipleFailoverExample + </clientClass> + <args> + <param>${basedir}/target/server0</param> + <param>${basedir}/target/server1</param> + <param>${basedir}/target/server2</param> + </args> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.activemq.examples.jms</groupId> + <artifactId>replicated-multiple-failover</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/replicated-multiple-failover/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-multiple-failover/readme.html b/examples/jms/replicated-multiple-failover/readme.html index d852f8f..63ec95f 100644 --- a/examples/jms/replicated-multiple-failover/readme.html +++ b/examples/jms/replicated-multiple-failover/readme.html @@ -26,7 +26,10 @@ under the License. </head> <body onload="prettyPrint()"> <h1>JMS Multiple Failover using Replication Example</h1> - + + <pre>To run the example, simply type <b>mvn verify</b> from this directory.</pre> + + <p>This example demonstrates three servers coupled as a live-backup-backup group for high availability (HA) using replication, and a client connection failing over from live to backup when the live server is crashed and then to the second backup once the new live fails.</p> @@ -38,133 +41,5 @@ under the License. <p>In this example, the live server is server 1, and the backup server is server 0</p> <p>The connection will initially be created to server1, server 1 will crash, and the client will carry on seamlessly on server 0, the backup server.</p> - - <ol> - <li>Get an initial context for looking up JNDI from server #0.</li> - <pre class="prettyprint"> - initialContext = getContext(0); - </pre> - - <li>Look up the JMS resources from JNDI on server #0.</li> - <pre class="prettyprint"> - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); - </pre> - - <li>Create a JMS Connection</li> - <pre class="prettyprint"> - connection = connectionFactory.createConnection(); - </pre> - - <li>Create a client acknowledged Session</li> - <pre class="prettyprint"> - Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); - </pre> - - <li>Start the connection to ensure delivery occurs</li> - <pre class="prettyprint"> - connection.start(); - </pre> - - <li>Create a JMS MessageProducer</li> - <pre class="prettyprint"> - MessageProducer producer = session.createProducer(queue); - </pre> - - <li>Create a JMS MessageConsumer</li> - <pre class="prettyprint"> - MessageConsumer consumer = session.createConsumer(queue); - </pre> - - <li>Send some messages to server #0, the live server</li> - <pre class="prettyprint"> - for (int i = 0; i < numMessages; i++) - { - TextMessage message = session.createTextMessage("This is text message " + i); - producer.send(message); - System.out.println("Sent message: " + message.getText()); - } - </pre> - - <li>Receive and acknowledge a third of the sent messages</li> - <pre class="prettyprint"> - TextMessage message0 = null; - for (int i = 0; i < numMessages / 3; i++) - { - message0 = (TextMessage)consumer.receive(5000); - System.out.println("Got message: " + message0.getText()); - } - message0.acknowledge(); - </pre> - - <p>When server #0 crashes, the client automatically detects the failure and automatically - fails over from server #0 to server #1 (in your real program you wouldn't need to sleep). - </p> - - <li>Acknowledging the 2nd third of the sent messages will fail as failover to the backup server has occurred</li> - <pre class="prettyprint"> - try - { - message0.acknowledge(); - } - catch (JMSException e) - { - System.err.println("Got exception while acknowledging message: " + e.getMessage()); - } - </pre> - - <li>Consume again the 2nd third of the messages again. Note that they are not considered as redelivered.</li> - <pre class="prettyprint"> - for (int i = numMessages / 3; i < (numMessages / 3) * 2; i++) - { - message0 = (TextMessage)consumer.receive(5000); - System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered()); - } - message0.acknowledge(); - </pre> - - <p>now we Kill server #1 and wait for the server #2 to take over the responsibilities.</p> - - <li>Acknowledging the 3rd third of the sent messages will fail as failover to the backup server has occurred</li> - <pre class="prettyprint"> - try - { - message0.acknowledge(); - } - catch (JMSException e) - { - System.err.println("Got exception while acknowledging message: " + e.getMessage()); - } - </pre> - - - <li>Consume again the 3rd third of the messages again. Note that they are not considered as redelivered</li> - <pre class="prettyprint"> - for (int i = (numMessages / 3) * 2; i < numMessages; i++) - { - message0 = (TextMessage)consumer.receive(5000); - System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered()); - } - message0.acknowledge(); - </pre> - - <li>And finally, <strong>always</strong> remember to close your 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"> - finally - { - if (connection != null) - { - connection.close(); - } - - if (initialContext != null) - { - initialContext.close(); - } - } - </pre> - - </ol> </body> </html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml index fb321c2..43f1693 100644 --- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <ha-policy> <replication> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml index 1cb959c..7f17fb8 100644 --- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <ha-policy> <replication> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml index fbbd45f..c5f06cc 100644 --- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml +++ b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <ha-policy> <replication> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-transaction-failover/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-transaction-failover/pom.xml b/examples/jms/replicated-transaction-failover/pom.xml index 2c10c66..437404c 100644 --- a/examples/jms/replicated-transaction-failover/pom.xml +++ b/examples/jms/replicated-transaction-failover/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-replicated-transaction-failover-example</artifactId> + <artifactId>replicated-transaction-failover</artifactId> <packaging>jar</packaging> <name>ActiveMQ Artemis JMS Replicated Transaction Failover Example</name> @@ -42,66 +43,62 @@ under the License. <version>${project.version}</version> </dependency> <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>create0</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server0</instance> - <configuration>${basedir}/target/classes/activemq/server0</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>create1</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server1</instance> - <configuration>${basedir}/target/classes/activemq/server1</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.ReplicatedTransactionFailoverExample</clientClass> - <args> - <param>${basedir}/target/server0</param> - <param>${basedir}/target/server1</param> - </args> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.activemq.examples.jms</groupId> - <artifactId>artemis-jms-replicated-transaction-failover-example</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> - </profiles> + <build> + <plugins> + <plugin> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-maven-plugin</artifactId> + <executions> + <execution> + <id>create0</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server0</instance> + <configuration>${basedir}/target/classes/activemq/server0</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>create1</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server1</instance> + <configuration>${basedir}/target/classes/activemq/server1</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>runClient</id> + <goals> + <goal>runClient</goal> + </goals> + <configuration> + <clientClass>org.apache.activemq.artemis.jms.example.ReplicatedTransactionFailoverExample + </clientClass> + <args> + <param>${basedir}/target/server0</param> + <param>${basedir}/target/server1</param> + </args> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.activemq.examples.jms</groupId> + <artifactId>replicated-transaction-failover</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/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml index 9233f17..f8b076a 100644 --- a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <ha-policy> <replication> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml index 848525e..f64af4e 100644 --- a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <ha-policy> <replication> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/request-reply/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/request-reply/pom.xml b/examples/jms/request-reply/pom.xml index e8849d8..74dd413 100644 --- a/examples/jms/request-reply/pom.xml +++ b/examples/jms/request-reply/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-request-reply-example</artifactId> + <artifactId>request-reply</artifactId> <packaging>jar</packaging> <name>ActiveMQ Artemis JMS Request Reply Example</name> @@ -37,70 +38,84 @@ 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.RequestReplyExample</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-request-reply-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> + <args> + <arg>--queues</arg> + <arg>exampleQueue</arg> + </args> + </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.RequestReplyExample</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>request-reply</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/request-reply/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/jms/request-reply/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/request-reply/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/jms/request-reply/src/main/resources/activemq/server0/artemis-roles.properties +++ /dev/null @@ -1,17 +0,0 @@ -## --------------------------------------------------------------------------- -## 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. -## --------------------------------------------------------------------------- -guest=guest \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/request-reply/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/jms/request-reply/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/request-reply/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/jms/request-reply/src/main/resources/activemq/server0/artemis-users.properties +++ /dev/null @@ -1,17 +0,0 @@ -## --------------------------------------------------------------------------- -## 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. -## --------------------------------------------------------------------------- -guest=guest \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/request-reply/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/request-reply/src/main/resources/activemq/server0/broker.xml b/examples/jms/request-reply/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 6c344c2..0000000 --- a/examples/jms/request-reply/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version='1.0'?> -<!-- -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. ---> - -<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="urn:activemq" - xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd"> - - <jms xmlns="urn:activemq:jms"> - <!--the queue used by the example--> - <queue name="exampleQueue"/> - </jms> - - <core xmlns="urn:activemq:core"> - - <bindings-directory>${data.dir}/server0/data/messaging/bindings</bindings-directory> - - <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory> - - <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory> - - <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory> - - <!-- Acceptors --> - <acceptors> - <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> - </acceptors> - - <!-- Other config --> - - <security-settings> - <!--security for example queues --> - <security-setting match="jms.queue.#"> - <permission type="createDurableQueue" roles="guest"/> - <permission type="deleteDurableQueue" roles="guest"/> - <permission type="createNonDurableQueue" roles="guest"/> - <permission type="deleteNonDurableQueue" roles="guest"/> - <permission type="consume" roles="guest"/> - <permission type="send" roles="guest"/> - </security-setting> - <!-- security settings for JMS temporary queue --> - <security-setting match="jms.tempqueue.#"> - <permission type="createNonDurableQueue" roles="guest"/> - <permission type="deleteNonDurableQueue" roles="guest"/> - <permission type="consume" roles="guest"/> - <permission type="send" roles="guest"/> - </security-setting> - </security-settings> - - </core> -</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/rest/dup-send/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/rest/dup-send/pom.xml b/examples/jms/rest/dup-send/pom.xml index 9d1a586..4d1b993 100644 --- a/examples/jms/rest/dup-send/pom.xml +++ b/examples/jms/rest/dup-send/pom.xml @@ -22,7 +22,7 @@ under the License. <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.activemq.examples.rest</groupId> - <artifactId>artemis-rest-examples-pom</artifactId> + <artifactId>artemis-rests-pom</artifactId> <version>1.0.1-SNAPSHOT</version> </parent> <artifactId>dup-send</artifactId> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/rest/javascript-chat/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/rest/javascript-chat/pom.xml b/examples/jms/rest/javascript-chat/pom.xml index 63958cc..9c84188 100644 --- a/examples/jms/rest/javascript-chat/pom.xml +++ b/examples/jms/rest/javascript-chat/pom.xml @@ -22,7 +22,7 @@ under the License. <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.activemq.examples.rest</groupId> - <artifactId>artemis-rest-examples-pom</artifactId> + <artifactId>artemis-rests-pom</artifactId> <version>1.0.1-SNAPSHOT</version> </parent> <artifactId>javascript-chat</artifactId> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/rest/jms-to-rest/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/rest/jms-to-rest/pom.xml b/examples/jms/rest/jms-to-rest/pom.xml index 08f7fae..0ccd4d8 100644 --- a/examples/jms/rest/jms-to-rest/pom.xml +++ b/examples/jms/rest/jms-to-rest/pom.xml @@ -22,7 +22,7 @@ under the License. <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.activemq.examples.rest</groupId> - <artifactId>artemis-rest-examples-pom</artifactId> + <artifactId>artemis-rests-pom</artifactId> <version>1.0.1-SNAPSHOT</version> </parent> <artifactId>mixed-jms-rest</artifactId> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/rest/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/rest/pom.xml b/examples/jms/rest/pom.xml index e19e7aa..57252e7 100644 --- a/examples/jms/rest/pom.xml +++ b/examples/jms/rest/pom.xml @@ -28,7 +28,7 @@ under the License. </parent> <groupId>org.apache.activemq.examples.rest</groupId> - <artifactId>artemis-rest-examples-pom</artifactId> + <artifactId>artemis-rests-pom</artifactId> <packaging>pom</packaging> <name>ActiveMQ Artemis REST Examples</name> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/rest/push/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/rest/push/pom.xml b/examples/jms/rest/push/pom.xml index 251fcaf..4a5ba53 100644 --- a/examples/jms/rest/push/pom.xml +++ b/examples/jms/rest/push/pom.xml @@ -22,7 +22,7 @@ under the License. <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.activemq.examples.rest</groupId> - <artifactId>artemis-rest-examples-pom</artifactId> + <artifactId>artemis-rests-pom</artifactId> <version>1.0.1-SNAPSHOT</version> </parent> <artifactId>push</artifactId> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/scale-down/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/scale-down/pom.xml b/examples/jms/scale-down/pom.xml index 596273b..bba30e2 100644 --- a/examples/jms/scale-down/pom.xml +++ b/examples/jms/scale-down/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> @@ -42,67 +43,63 @@ under the License. <version>${project.version}</version> </dependency> <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>create0</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server0</instance> - <configuration>${basedir}/target/classes/activemq/server0</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>create1</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <instance>${basedir}/target/server1</instance> - <configuration>${basedir}/target/classes/activemq/server1</configuration> - <javaOptions>-Dudp-address=${udp-address}</javaOptions> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.ScaleDownExample</clientClass> - <args> - <param>${basedir}/target/server0</param> - <param>${basedir}/target/server1</param> - </args> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.activemq.examples.jms</groupId> - <artifactId>scale-down</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> - </profiles> + <build> + <plugins> + <plugin> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-maven-plugin</artifactId> + <executions> + <execution> + <id>create0</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server0</instance> + <configuration>${basedir}/target/classes/activemq/server0</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>create1</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <instance>${basedir}/target/server1</instance> + <configuration>${basedir}/target/classes/activemq/server1</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>runClient</id> + <goals> + <goal>runClient</goal> + </goals> + <configuration> + <clientClass>org.apache.activemq.artemis.jms.example.ScaleDownExample</clientClass> + <args> + <param>${basedir}/target/server0</param> + <param>${basedir}/target/server1</param> + </args> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.activemq.examples.jms</groupId> + <artifactId>scale-down</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/scale-down/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/scale-down/readme.html b/examples/jms/scale-down/readme.html index a73a170..c129764 100644 --- a/examples/jms/scale-down/readme.html +++ b/examples/jms/scale-down/readme.html @@ -27,6 +27,9 @@ under the License. <body onload="prettyPrint()"> <h1>JMS Colocated Failover Shared Store Example</h1> + <pre>To run the example, simply type <b>mvn verify</b> from this directory.</pre> + + <p>This example demonstrates how you can configure a live server to scale down messages to another live server on shutdown. <p>This example starts 2 live servers each one with a connector configured for the other live server.</p> <p>The second live server is killed and its messages are scaled down to the first server on shutdown.</p> @@ -44,128 +47,5 @@ under the License. </ha-policy> </code> </pre> - <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> Get an initial context for looking up JNDI for both servers</li> - <pre class="prettyprint"> - <code> - initialContext1 = getContext(1); - initialContext = getContext(0); - </code> - </pre> - - <li>Look up the JMS resources from JNDI</li> - <pre class="prettyprint"> - <code> - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); - ConnectionFactory connectionFactory1 = (ConnectionFactory)initialContext1.lookup("/ConnectionFactory"); - </code> - </pre> - - <li>Create a JMS Connections</li> - <pre class="prettyprint"> - <code> - connection = connectionFactory.createConnection(); - connection1 = connectionFactory1.createConnection(); - </code> - </pre> - - <li>Create a *non-transacted* JMS Session with client acknowledgement</li> - <pre class="prettyprint"> - <code> - Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); - Session session1 = connection1.createSession(false, Session.CLIENT_ACKNOWLEDGE); - </code> - </pre> - - <li>Create a JMS MessageProducer</li> - <pre class="prettyprint"> - <code> - MessageProducer producer = session.createProducer(queue); - MessageProducer producer1 = session1.createProducer(queue); - </code> - </pre> - - <li>Send some messages to both servers</li> - <pre class="prettyprint"> - <code> - for (int i = 0; i < numMessages; i++) - { - TextMessage message = session.createTextMessage("This is text message " + i); - producer.send(message); - System.out.println("Sent message: " + message.getText()); - message = session1.createTextMessage("This is another text message " + i); - producer1.send(message); - System.out.println("Sent message: " + message.getText()); - } - </code> - </pre> - - <li>Crash server #0, the live server</li> - <pre class="prettyprint"> - <code> - killServer(0); - </code> - </pre> - - <li>start the connection ready to receive messages</li> - <pre class="prettyprint"> - <code> - connection.start(); - </code> - </pre> - - <li>create a consumer</li> - <pre class="prettyprint"> - <code> - MessageConsumer consumer = session.createConsumer(queue); - </code> - </pre> - - <li>Receive and acknowledge all of the sent messages, you will notice that messages from both servers are received</li> - <pre class="prettyprint"> - <code> - TextMessage message0 = null; - for (int i = 0; i < numMessages; i++) - { - message0 = (TextMessage)consumer.receive(5000); - System.out.println("Got message: " + message0.getText()); - } - message0.acknowledge(); - </code> - </pre> - - <li>And finally (no pun intended), <b>always</b> remember to close your JMS 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 (connection != null) - { - connection.close(); - } - - if (initialContext != null) - { - initialContext.close(); - } - if (connection1 != null) - { - connection1.close(); - } - - if (initialContext1 != null) - { - initialContext1.close(); - } - } - </code> - </pre> - - </ol> </body> </html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml b/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml index 1a08c9d..559bb5a 100644 --- a/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <!-- Connectors --> <connectors> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml b/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml index 87dd4aa..6211cd3 100644 --- a/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. <core xmlns="urn:activemq:core"> - <bindings-directory>${data.dir:./data}/bindings</bindings-directory> + <bindings-directory>./data/bindings</bindings-directory> - <journal-directory>${data.dir:./data}/journal</journal-directory> + <journal-directory>./data/journal</journal-directory> - <large-messages-directory>${data.dir:./data}/largemessages</large-messages-directory> + <large-messages-directory>./data/largemessages</large-messages-directory> - <paging-directory>${data.dir:./data}/paging</paging-directory> + <paging-directory>./data/paging</paging-directory> <!-- Connectors --> <connectors> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/scheduled-message/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/scheduled-message/pom.xml b/examples/jms/scheduled-message/pom.xml index cfda2ac..15653a9 100644 --- a/examples/jms/scheduled-message/pom.xml +++ b/examples/jms/scheduled-message/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-scheduled-message-example</artifactId> + <artifactId>scheduled-message</artifactId> <packaging>jar</packaging> <name>ActiveMQ Artemis JMS Scheduled Message Example</name> @@ -42,71 +43,81 @@ under the License. <version>${project.version}</version> </dependency> <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.ScheduledMessageExample</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-scheduled-message-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.ScheduledMessageExample</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>scheduled-message</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/scheduled-message/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/scheduled-message/readme.html b/examples/jms/scheduled-message/readme.html index b2d1621..e87406d 100644 --- a/examples/jms/scheduled-message/readme.html +++ b/examples/jms/scheduled-message/readme.html @@ -27,11 +27,14 @@ under the License. <body onload="prettyPrint()"> <h1>JMS Scheduled Message 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 send a scheduled message to a JMS Queue using ActiveMQ Artemis.</p> - <p>A Scheduled Message is a message that will be delivered at a time specified by the sender. To do this, - simply set a HDR_SCHEDULED_DELIVERY_TIME header property. The value of the property should be the time of + <p>A Scheduled Message is a message that will be delivered at a time specified by the sender. To do this, + simply set a HDR_SCHEDULED_DELIVERY_TIME header property. The value of the property should be the time of delivery in milliseconds. </p> - + <p>In this example, a message is created with the scheduled delivery time set to 5 seconds after the current time.</p> @@ -120,12 +123,12 @@ under the License. </pre> </ol> - + <h2>More information</h2> - + <ul> <li>User Manual's <a href="../../../docs/user-manual/en/html_single/index.html#scheduled-messages">Scheduled Messages chapter</a></li> </ul> - + </body> </html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dd820318/examples/jms/security/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/security/pom.xml b/examples/jms/security/pom.xml index a58e177..9bc4d1a 100644 --- a/examples/jms/security/pom.xml +++ b/examples/jms/security/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-security-example</artifactId> + <artifactId>security</artifactId> <packaging>jar</packaging> <name>ActiveMQ Artemis JMS Security Example</name> @@ -37,73 +38,83 @@ 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> - <testUser>bill</testUser> - <testPassword>activemq</testPassword> - <args> - <param>run</param> - </args> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.SecurityExample</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-security-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> + <testUser>bill</testUser> + <testPassword>activemq</testPassword> + <args> + <param>run</param> + </args> + </configuration> + </execution> + <execution> + <id>runClient</id> + <goals> + <goal>runClient</goal> + </goals> + <configuration> + <clientClass>org.apache.activemq.artemis.jms.example.SecurityExample</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>security</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project>
