You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/12 05:46:57 UTC
[03/52] [abbrv] [partial] activemq-artemis git commit: This commit
has improvements on the examples including:
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stop-server-failover/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stop-server-failover/pom.xml b/examples/jms/stop-server-failover/pom.xml
deleted file mode 100644
index 0a1a9fa..0000000
--- a/examples/jms/stop-server-failover/pom.xml
+++ /dev/null
@@ -1,169 +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.
--->
-
-<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>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>jms-examples</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>stop-server-failover</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis JMS Stop Server Failover Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../..</activemq.basedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <!-- 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>create0</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <instance>${basedir}/target/server0</instance>
- <sharedStore>true</sharedStore>
- <slave>false</slave>
- <dataFolder>../data</dataFolder>
- <failoverOnShutdown>true</failoverOnShutdown>
- </configuration>
- </execution>
- <execution>
- <id>create1</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <instance>${basedir}/target/server1</instance>
- <sharedStore>true</sharedStore>
- <slave>true</slave>
- <dataFolder>../data</dataFolder>
- <failoverOnShutdown>true</failoverOnShutdown>
- </configuration>
- </execution>
- <execution>
- <id>start0</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server0</location>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server0</name>
- </configuration>
- </execution>
- <execution>
- <id>start1</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server1</location>
- <testURI>tcp://localhost:61617</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server1</name>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.jms.example.StopServerFailoverExample</clientClass>
- </configuration>
- </execution>
- <execution>
- <id>stop0</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <location>${basedir}/target/server0</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>stop1</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <location>${basedir}/target/server1</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>stop-server-failover</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stop-server-failover/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/stop-server-failover/readme.html b/examples/jms/stop-server-failover/readme.html
deleted file mode 100644
index bea5755..0000000
--- a/examples/jms/stop-server-failover/readme.html
+++ /dev/null
@@ -1,44 +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.
--->
-
-<html>
- <head>
- <title>ActiveMQ Artemis JMS Failover Without Transactions Example</title>
- <link rel="stylesheet" type="text/css" href="../common/common.css" />
- <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
- <script type="text/javascript" src="../common/prettify.js"></script>
- </head>
- <body onload="prettyPrint()">
- <h1>JMS Failover Without Transactions 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 two servers coupled as a live-backup pair for high availability (HA), and a client
- connection failing over from live to backup when the live server is crashed.</p>
- <p>Failover behavior differs whether the JMS session is transacted or not.</p>
- <p>When a <em>non-transacted</em> JMS session is used, once and only once delivery is not guaranteed
- and it is possible some messages will be lost or delivered twice, depending when the failover to the backup server occurs.</p>
- <p>It is up to the client to deal with such cases. To ensure once and only once delivery, the client must
- use transacted JMS sessions (as shown in the example for <a href="../transaction-failover/readme.html">failover with transactions</a>).</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>
-
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java b/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java
deleted file mode 100644
index 38f06c0..0000000
--- a/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java
+++ /dev/null
@@ -1,117 +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.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-/**
- * A simple example that demonstrates failover of the JMS connection from one node to another
- * when the live server crashes using a JMS <em>non-transacted</em> session.
- */
-public class StopServerFailoverExample {
-
- public static void main(final String[] args) throws Exception {
- final int numMessages = 10;
-
- Connection connection = null;
-
- InitialContext initialContext = null;
-
- try {
- // Step 1. Get an initial context for looking up JNDI from the server #1
- initialContext = new InitialContext();
-
- // Step 2. Look up the JMS resources from JNDI
- Queue queue = (Queue) initialContext.lookup("queue/exampleQueue");
- ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
-
- // Step 3. Create a JMS Connection
- connection = connectionFactory.createConnection();
-
- // Step 4. Create a *non-transacted* JMS Session with client acknowledgement
- Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
- // Step 5. Start the connection to ensure delivery occurs
- connection.start();
-
- // Step 6. Create a JMS MessageProducer and a MessageConsumer
- MessageProducer producer = session.createProducer(queue);
- MessageConsumer consumer = session.createConsumer(queue);
-
- // Step 7. Send some messages to server #1, the live server
- 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());
- }
-
- // Step 8. Receive and acknowledge half of the sent messages
- TextMessage message0 = null;
- for (int i = 0; i < numMessages / 2; i++) {
- message0 = (TextMessage) consumer.receive(5000);
- System.out.println("Got message: " + message0.getText());
- }
- message0.acknowledge();
-
- // Step 9. Receive the 2nd half of the sent messages but *do not* acknowledge them yet
- for (int i = numMessages / 2; i < numMessages; i++) {
- message0 = (TextMessage) consumer.receive(5000);
- System.out.println("Got message: " + message0.getText());
- }
-
- // Step 10. Crash server #0, the live server, and wait a little while to make sure
- // it has really crashed
- System.out.println("Stop the live server by logging into JConsole and then press any key to continue...");
- System.in.read();
-
- // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
- // backup server has occurred
- try {
- message0.acknowledge();
- }
- catch (JMSException e) {
- System.err.println("Got exception while acknowledging message: " + e.getMessage());
- }
-
- // Step 12. Consume again the 2nd half of the messages again. Note that they are not considered as redelivered.
- for (int i = numMessages / 2; i < numMessages; i++) {
- message0 = (TextMessage) consumer.receive(5000);
- System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
- }
- message0.acknowledge();
- }
- finally {
- // Step 13. Be sure to close our resources!
-
- if (connection != null) {
- connection.close();
- }
-
- if (initialContext != null) {
- initialContext.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stop-server-failover/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stop-server-failover/src/main/resources/jndi.properties b/examples/jms/stop-server-failover/src/main/resources/jndi.properties
deleted file mode 100644
index 7f7a19f..0000000
--- a/examples/jms/stop-server-failover/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,20 +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.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
-queue.queue/exampleQueue=exampleQueue
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/pom.xml b/examples/jms/symmetric-cluster/pom.xml
deleted file mode 100644
index f471314..0000000
--- a/examples/jms/symmetric-cluster/pom.xml
+++ /dev/null
@@ -1,329 +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.
--->
-
-<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>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>jms-examples</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>symmetric-cluster</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis JMS Symmetric Cluster Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../..</activemq.basedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <!-- 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>create0</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <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>
- <ignore>${noSever}</ignore>
- <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>
- <ignore>${noSever}</ignore>
- <instance>${basedir}/target/server2</instance>
- <configuration>${basedir}/target/classes/activemq/server2</configuration>
- <javaOptions>-Dudp-address=${udp-address}</javaOptions>
- </configuration>
- </execution>
- <execution>
- <id>create3</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <instance>${basedir}/target/server3</instance>
- <configuration>${basedir}/target/classes/activemq/server3</configuration>
- <javaOptions>-Dudp-address=${udp-address}</javaOptions>
- </configuration>
- </execution>
- <execution>
- <id>create4</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <instance>${basedir}/target/server4</instance>
- <configuration>${basedir}/target/classes/activemq/server4</configuration>
- <javaOptions>-Dudp-address=${udp-address}</javaOptions>
- </configuration>
- </execution>
- <execution>
- <id>create5</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <instance>${basedir}/target/server5</instance>
- <configuration>${basedir}/target/classes/activemq/server5</configuration>
- <javaOptions>-Dudp-address=${udp-address}</javaOptions>
- </configuration>
- </execution>
- <execution>
- <id>start0</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server0</location>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server0</name>
- </configuration>
- </execution>
- <execution>
- <id>start1</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server1</location>
- <testURI>tcp://localhost:61617</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server1</name>
- </configuration>
- </execution>
- <execution>
- <id>start2</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server2</location>
- <testURI>tcp://localhost:61618</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server2</name>
- </configuration>
- </execution>
- <execution>
- <id>start3</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server3</location>
- <testURI>tcp://localhost:61619</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server3</name>
- </configuration>
- </execution>
- <execution>
- <id>start4</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server4</location>
- <testURI>tcp://localhost:61620</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server4</name>
- </configuration>
- </execution>
- <execution>
- <id>start5</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server5</location>
- <testURI>tcp://localhost:61621</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server5</name>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.jms.example.SymmetricClusterExample</clientClass>
- </configuration>
- </execution>
- <execution>
- <id>stop0</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <location>${basedir}/target/server0</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>stop1</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <location>${basedir}/target/server1</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>stop2</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <location>${basedir}/target/server2</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>stop3</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <location>${basedir}/target/server3</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>stop4</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <location>${basedir}/target/server4</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>stop5</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noSever}</ignore>
- <location>${basedir}/target/server5</location>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>symmetric-cluster</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/readme.html b/examples/jms/symmetric-cluster/readme.html
deleted file mode 100644
index dc8ebc2..0000000
--- a/examples/jms/symmetric-cluster/readme.html
+++ /dev/null
@@ -1,74 +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.
--->
-
-<html>
- <head>
- <title>ActiveMQ Artemis JMS Symmetric Cluster Example</title>
- <link rel="stylesheet" type="text/css" href="../common/common.css" />
- <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
- <script type="text/javascript" src="../common/prettify.js"></script>
- </head>
- <body onload="prettyPrint()">
- <h1>JMS Symmetric Cluster 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 examples demonstrates a <b>symmetric cluster</b> set-up with ActiveMQ Artemis.</p>
- <p>ActiveMQ Artemis has extremely flexible clustering which allows you to set-up servers in
- many different topologies.</p>
- <p>The most common topology that you'll perhaps be familiar with if you are used to application
- server clustering is a <b>symmetric cluster</b>.</p>
- <p>With a symmetric cluster, the cluster is homogeneous, i.e. each node is configured the same
- as every other node, and every node is connected to every other node in the cluster.</p>
- <p>By connecting node in such a way, we can, from a JMS point of view, give the impression of distributed
- JMS queues and topics.</p>
- <p>The configuration used in this example is very similar to the configuration used by ActiveMQ
- when installed as a clustered profile in JBoss Application Server.</p>
- <p>To set up ActiveMQ Artemis to form a symmetric cluster we simply need to mark each server as <code>clustered</code>
- and we need to define a <code>cluster-connection</code> in <code>broker.xml</code>.</p>
- <p>The <code>cluster-connection</code> tells the nodes what other nodes to make connections to.
- With a <code>cluster-connection</code> each node that we connect to can either be specified
- indivually, or we can use UDP discovery to find out what other nodes are in the cluster.</p>
- <p>Using UDP discovery makes configuration simpler since we don't have to know what nodes are
- available at any one time.</p>
- <p>Here's the relevant snippet from the server configuration, which tells the server to form a cluster
- with the other nodes:</p>
- <pre class="prettyprint">
- <code>
- <cluster-connection name="my-cluster">
- <address>jms</address>
- <connector-ref>netty-connector</connector-ref>
- <retry-interval>500</retry-interval>
- <use-duplicate-detection>true</use-duplicate-detection>
- <message-load-balancing>STRICT</message-load-balancing>
- <max-hops>1</max-hops>
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- </cluster-connection>
- </code>
- </pre>
- <p>In this example we create a symmetric cluster of six live nodes, and we also pair each live node
- with it's own backup node. (A backup node is not strictly necessary for a symmetric cluster).</p>
- <p>In this example will we will demonstrate this by deploying a JMS topic and Queue on all nodes of the cluster
- , sending messages to the queue and topic from different nodes, and verifying messages are received correctly
- by consumers on different nodes.</p>
- <p>For more information on configuring ActiveMQ Artemis clustering in general, please see the clustering
- section of the user manual.</p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java b/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java
deleted file mode 100644
index 1163ec8..0000000
--- a/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java
+++ /dev/null
@@ -1,222 +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.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-
-import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
-import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-
-/**
- * This example demonstrates a cluster of three nodes set up in a symmetric topology - i.e. each
- * node is connected to every other node in the cluster. Also each node, has it's own backup node.
- * <p>
- * This is probably the most obvious clustering topology and the one most people will be familiar
- * with from using clustering in an app server, where every node has pretty much identical
- * configuration to every other node.
- * <p>
- * By clustering nodes symmetrically, ActiveMQ Artemis can give the impression of clustered queues, topics
- * and durable subscriptions.
- * <p>
- * In this example we send some messages to a distributed queue and topic and kill all the live
- * servers at different times, and verify that they transparently fail over onto their backup
- * servers.
- * <p>
- * Please see the readme.html file for more information.
- */
-public class SymmetricClusterExample {
-
- public static void main(final String[] args) throws Exception {
- Connection connection0 = null;
-
- Connection connection1 = null;
-
- Connection connection2 = null;
-
- Connection connection3 = null;
-
- Connection connection4 = null;
-
- Connection connection5 = null;
-
- try {
- // Step 1 - We instantiate a connection factory directly, specifying the UDP address and port for discovering
- // the list of servers in the cluster.
- // We could use JNDI to look-up a connection factory, but we'd need to know the JNDI server host and port for
- // the
- // specific server to do that, and that server might not be available at the time. By creating the
- // connection factory directly we avoid having to worry about a JNDI look-up.
- // In an app server environment you could use HA-JNDI to lookup from the clustered JNDI servers without
- // having to know about a specific one.
- UDPBroadcastEndpointFactory udpCfg = new UDPBroadcastEndpointFactory();
- udpCfg.setGroupAddress("231.7.7.7").setGroupPort(9876);
- DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration();
- groupConfiguration.setBroadcastEndpointFactory(udpCfg);
-
- ConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.CF);
-
- // We give a little while for each server to broadcast its whereabouts to the client
- Thread.sleep(2000);
-
- // Step 2. Directly instantiate JMS Queue and Topic objects
- Queue queue = ActiveMQJMSClient.createQueue("exampleQueue");
-
- Topic topic = ActiveMQJMSClient.createTopic("exampleTopic");
-
- // Step 3. We create six connections, they should be to different nodes of the cluster in a round-robin fashion
- // and start them
- connection0 = cf.createConnection();
-
- connection1 = cf.createConnection();
-
- connection2 = cf.createConnection();
-
- connection3 = cf.createConnection();
-
- connection4 = cf.createConnection();
-
- connection5 = cf.createConnection();
-
- connection0.start();
-
- connection1.start();
-
- connection2.start();
-
- connection3.start();
-
- connection4.start();
-
- connection5.start();
-
- // Step 4. We create a session on each connection
-
- Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session session3 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session session4 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session session5 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Step 5. We create a topic subscriber on each server
-
- MessageConsumer subscriber0 = session0.createConsumer(topic);
-
- MessageConsumer subscriber1 = session1.createConsumer(topic);
-
- MessageConsumer subscriber2 = session2.createConsumer(topic);
-
- MessageConsumer subscriber3 = session3.createConsumer(topic);
-
- MessageConsumer subscriber4 = session4.createConsumer(topic);
-
- MessageConsumer subscriber5 = session5.createConsumer(topic);
-
- // Step 6. We create a queue consumer on server 0
-
- MessageConsumer consumer0 = session0.createConsumer(queue);
-
- // Step 7. We create an anonymous message producer on just one server 2
-
- MessageProducer producer2 = session2.createProducer(null);
-
- // Step 8. We send 500 messages each to the queue and topic
-
- final int numMessages = 500;
-
- for (int i = 0; i < numMessages; i++) {
- TextMessage message1 = session2.createTextMessage("Topic message " + i);
-
- producer2.send(topic, message1);
-
- TextMessage message2 = session2.createTextMessage("Queue message " + i);
-
- producer2.send(queue, message2);
- }
-
- // Step 9. Verify all subscribers and the consumer receive the messages
-
- for (int i = 0; i < numMessages; i++) {
- TextMessage received0 = (TextMessage) subscriber0.receive(5000);
-
- if (received0 == null) {
- throw new IllegalStateException("Message is null!");
- }
-
- TextMessage received1 = (TextMessage) subscriber1.receive(5000);
-
- if (received1 == null) {
- throw new IllegalStateException("Message is null!");
- }
-
- TextMessage received2 = (TextMessage) subscriber2.receive(5000);
-
- if (received2 == null) {
- throw new IllegalStateException("Message is null!");
- }
-
- TextMessage received3 = (TextMessage) subscriber3.receive(5000);
-
- if (received3 == null) {
- throw new IllegalStateException("Message is null!");
- }
-
- TextMessage received4 = (TextMessage) subscriber4.receive(5000);
-
- if (received4 == null) {
- throw new IllegalStateException("Message is null!");
- }
-
- TextMessage received5 = (TextMessage) subscriber5.receive(5000);
-
- if (received5 == null) {
- throw new IllegalStateException("Message is null!");
- }
-
- TextMessage received6 = (TextMessage) consumer0.receive(5000);
-
- if (received6 == null) {
- throw new IllegalStateException("Message is null!");
- }
- }
- }
- finally {
- // Step 15. Be sure to close our resources!
-
- connection0.close();
- connection1.close();
- connection2.close();
- connection3.close();
- connection4.close();
- connection5.close();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index cd89de7..0000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,99 +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">
- <queue name="exampleQueue"/>
-
- <topic name="exampleTopic"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
-
- <!-- Connectors -->
-
- <connectors>
- <connector name="netty-connector">tcp://localhost:61616</connector>
-
- </connectors>
-
- <!-- Acceptors -->
- <acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
- </acceptors>
-
- <!-- Clustering configuration -->
- <broadcast-groups>
- <broadcast-group name="my-broadcast-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <broadcast-period>100</broadcast-period>
- <connector-ref>netty-connector</connector-ref>
- </broadcast-group>
- </broadcast-groups>
-
- <discovery-groups>
- <discovery-group name="my-discovery-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <refresh-timeout>10000</refresh-timeout>
- </discovery-group>
- </discovery-groups>
-
- <cluster-connections>
- <cluster-connection name="my-cluster">
- <address>jms</address>
- <connector-ref>netty-connector</connector-ref>
- <retry-interval>500</retry-interval>
- <use-duplicate-detection>true</use-duplicate-detection>
- <message-load-balancing>ON_DEMAND</message-load-balancing>
- <max-hops>1</max-hops>
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- </cluster-connection>
- </cluster-connections>
-
- <!-- Other config -->
-
- <security-settings>
- <!-- Default JMS security -->
- <security-setting match="jms.#">
- <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>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
deleted file mode 100644
index d95a1cd..0000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
+++ /dev/null
@@ -1,97 +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">
- <queue name="exampleQueue"/>
-
- <topic name="exampleTopic"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Connectors -->
-
- <connectors>
- <connector name="netty-connector">tcp://localhost:61617</connector>
- </connectors>
-
- <!-- Acceptors -->
- <acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61617</acceptor>
- </acceptors>
-
- <!-- Clustering configuration -->
- <broadcast-groups>
- <broadcast-group name="my-broadcast-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <broadcast-period>100</broadcast-period>
- <connector-ref>netty-connector</connector-ref>
- </broadcast-group>
- </broadcast-groups>
-
- <discovery-groups>
- <discovery-group name="my-discovery-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <refresh-timeout>10000</refresh-timeout>
- </discovery-group>
- </discovery-groups>
-
- <cluster-connections>
- <cluster-connection name="my-cluster">
- <address>jms</address>
- <connector-ref>netty-connector</connector-ref>
- <retry-interval>500</retry-interval>
- <use-duplicate-detection>true</use-duplicate-detection>
- <message-load-balancing>ON_DEMAND</message-load-balancing>
- <max-hops>1</max-hops>
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- </cluster-connection>
- </cluster-connections>
-
- <!-- Other config -->
-
- <security-settings>
- <!-- Default JMS security -->
- <security-setting match="jms.#">
- <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>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
deleted file mode 100644
index ef006fd..0000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
+++ /dev/null
@@ -1,97 +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">
- <queue name="exampleQueue"/>
-
- <topic name="exampleTopic"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Connectors -->
-
- <connectors>
- <connector name="netty-connector">tcp://localhost:61618</connector>
- </connectors>
-
- <!-- Acceptors -->
- <acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61618</acceptor>
- </acceptors>
-
- <!-- Clustering configuration -->
- <broadcast-groups>
- <broadcast-group name="my-broadcast-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <broadcast-period>100</broadcast-period>
- <connector-ref>netty-connector</connector-ref>
- </broadcast-group>
- </broadcast-groups>
-
- <discovery-groups>
- <discovery-group name="my-discovery-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <refresh-timeout>10000</refresh-timeout>
- </discovery-group>
- </discovery-groups>
-
- <cluster-connections>
- <cluster-connection name="my-cluster">
- <address>jms</address>
- <connector-ref>netty-connector</connector-ref>
- <retry-interval>500</retry-interval>
- <use-duplicate-detection>true</use-duplicate-detection>
- <message-load-balancing>ON_DEMAND</message-load-balancing>
- <max-hops>1</max-hops>
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- </cluster-connection>
- </cluster-connections>
-
- <!-- Other config -->
-
- <security-settings>
- <!-- Default JMS security -->
- <security-setting match="jms.#">
- <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>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
deleted file mode 100644
index a780ace..0000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
+++ /dev/null
@@ -1,97 +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">
- <queue name="exampleQueue"/>
-
- <topic name="exampleTopic"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Connectors -->
-
- <connectors>
- <connector name="netty-connector">tcp://localhost:61619</connector>
- </connectors>
-
- <!-- Acceptors -->
- <acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61619</acceptor>
- </acceptors>
-
- <!-- Clustering configuration -->
- <broadcast-groups>
- <broadcast-group name="my-broadcast-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <broadcast-period>100</broadcast-period>
- <connector-ref>netty-connector</connector-ref>
- </broadcast-group>
- </broadcast-groups>
-
- <discovery-groups>
- <discovery-group name="my-discovery-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <refresh-timeout>10000</refresh-timeout>
- </discovery-group>
- </discovery-groups>
-
- <cluster-connections>
- <cluster-connection name="my-cluster">
- <address>jms</address>
- <connector-ref>netty-connector</connector-ref>
- <retry-interval>500</retry-interval>
- <use-duplicate-detection>true</use-duplicate-detection>
- <message-load-balancing>ON_DEMAND</message-load-balancing>
- <max-hops>1</max-hops>
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- </cluster-connection>
- </cluster-connections>
-
- <!-- Other config -->
-
- <security-settings>
- <!-- Default JMS security -->
- <security-setting match="jms.#">
- <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>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
deleted file mode 100644
index 20b622e..0000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
+++ /dev/null
@@ -1,96 +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">
- <queue name="exampleQueue"/>
-
- <topic name="exampleTopic"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Connectors -->
- <connectors>
- <connector name="netty-connector">tcp://localhost:61620</connector>
- </connectors>
-
- <!-- Acceptors -->
- <acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61620</acceptor>
- </acceptors>
-
- <!-- Clustering configuration -->
- <broadcast-groups>
- <broadcast-group name="my-broadcast-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <broadcast-period>100</broadcast-period>
- <connector-ref>netty-connector</connector-ref>
- </broadcast-group>
- </broadcast-groups>
-
- <discovery-groups>
- <discovery-group name="my-discovery-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <refresh-timeout>10000</refresh-timeout>
- </discovery-group>
- </discovery-groups>
-
- <cluster-connections>
- <cluster-connection name="my-cluster">
- <address>jms</address>
- <connector-ref>netty-connector</connector-ref>
- <retry-interval>500</retry-interval>
- <use-duplicate-detection>true</use-duplicate-detection>
- <message-load-balancing>ON_DEMAND</message-load-balancing>
- <max-hops>1</max-hops>
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- </cluster-connection>
- </cluster-connections>
-
- <!-- Other config -->
-
- <security-settings>
- <!-- Default JMS security -->
- <security-setting match="jms.#">
- <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>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
deleted file mode 100644
index 033af43..0000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
+++ /dev/null
@@ -1,96 +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">
- <queue name="exampleQueue"/>
-
- <topic name="exampleTopic"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Connectors -->
- <connectors>
- <connector name="netty-connector">tcp://localhost:61621</connector>
- </connectors>
-
- <!-- Acceptors -->
- <acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61621</acceptor>
- </acceptors>
-
- <!-- Clustering configuration -->
- <broadcast-groups>
- <broadcast-group name="my-broadcast-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <broadcast-period>100</broadcast-period>
- <connector-ref>netty-connector</connector-ref>
- </broadcast-group>
- </broadcast-groups>
-
- <discovery-groups>
- <discovery-group name="my-discovery-group">
- <group-address>${udp-address:231.7.7.7}</group-address>
- <group-port>9876</group-port>
- <refresh-timeout>10000</refresh-timeout>
- </discovery-group>
- </discovery-groups>
-
- <cluster-connections>
- <cluster-connection name="my-cluster">
- <address>jms</address>
- <connector-ref>netty-connector</connector-ref>
- <retry-interval>500</retry-interval>
- <use-duplicate-detection>true</use-duplicate-detection>
- <message-load-balancing>ON_DEMAND</message-load-balancing>
- <max-hops>1</max-hops>
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- </cluster-connection>
- </cluster-connections>
-
- <!-- Other config -->
-
- <security-settings>
- <!-- Default JMS security -->
- <security-setting match="jms.#">
- <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>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/temp-queue/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/temp-queue/pom.xml b/examples/jms/temp-queue/pom.xml
deleted file mode 100644
index ef544e1..0000000
--- a/examples/jms/temp-queue/pom.xml
+++ /dev/null
@@ -1,118 +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.
--->
-
-<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>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>jms-examples</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>temp-queue</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis JMS Temporary Queue Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../..</activemq.basedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <!-- 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.TemporaryQueueExample</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>temp-queue</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/temp-queue/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/temp-queue/readme.html b/examples/jms/temp-queue/readme.html
deleted file mode 100644
index f1cae4d..0000000
--- a/examples/jms/temp-queue/readme.html
+++ /dev/null
@@ -1,40 +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.
--->
-
-<html>
- <head>
- <title>ActiveMQ Artemis JMS Temporary Queue Example</title>
- <link rel="stylesheet" type="text/css" href="../common/common.css" />
- <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
- <script type="text/javascript" src="../common/prettify.js"></script>
- </head>
- <body onload="prettyPrint()">
- <h1>JMS Temporary Queue 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 TemporaryQueue with ActiveMQ Artemis. First a temporary queue is created to send and receive a message and then deleted.
- Then another temporary queue is created and used after its connection is closed to illustrate its scope.</p>
- <p>A TemporaryQueue is a JMS queue that exists only within the lifetime of its connection. It is often used in request-reply
- type messaging where the reply is sent through a temporary destination. The temporary queue is often created as
- a server resource, so after using, the user should call delete() method to release the resources.
- Please consult the JMS 1.1 specification for full details.</p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java b/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java
deleted file mode 100644
index 5747fae..0000000
--- a/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java
+++ /dev/null
@@ -1,118 +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.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TemporaryQueue;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-/**
- * A simple JMS example that shows how to use temporary queues.
- */
-public class TemporaryQueueExample {
-
- public static void main(final String[] args) throws Exception {
- Connection connection = null;
- InitialContext initialContext = null;
- try {
- // Step 1. Create an initial context to perform the JNDI lookup.
- initialContext = new InitialContext();
-
- // Step 2. Look-up the JMS connection factory
- ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
-
- // Step 3. Create a JMS Connection
- connection = cf.createConnection();
-
- // Step 4. Start the connection
- connection.start();
-
- // Step 5. Create a JMS session with AUTO_ACKNOWLEDGE mode
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Step 6. Create a Temporary Queue
- TemporaryQueue tempQueue = session.createTemporaryQueue();
-
- System.out.println("Temporary queue is created: " + tempQueue);
-
- // Step 7. Create a JMS message producer
- MessageProducer messageProducer = session.createProducer(tempQueue);
-
- // Step 8. Create a text message
- TextMessage message = session.createTextMessage("This is a text message");
-
- // Step 9. Send the text message to the queue
- messageProducer.send(message);
-
- System.out.println("Sent message: " + message.getText());
-
- // Step 11. Create a message consumer
- MessageConsumer messageConsumer = session.createConsumer(tempQueue);
-
- // Step 12. Receive the message from the queue
- message = (TextMessage) messageConsumer.receive(5000);
-
- System.out.println("Received message: " + message.getText());
-
- // Step 13. Close the consumer and producer
- messageConsumer.close();
- messageProducer.close();
-
- // Step 14. Delete the temporary queue
- tempQueue.delete();
-
- // Step 15. Create another temporary queue.
- TemporaryQueue tempQueue2 = session.createTemporaryQueue();
-
- System.out.println("Another temporary queue is created: " + tempQueue2);
-
- // Step 16. Close the connection.
- connection.close();
-
- // Step 17. Create a new connection.
- connection = cf.createConnection();
-
- // Step 18. Create a new session.
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Step 19. Try to access the tempQueue2 outside its lifetime
- try {
- messageConsumer = session.createConsumer(tempQueue2);
- throw new Exception("Temporary queue cannot be accessed outside its lifecycle!");
- }
- catch (JMSException e) {
- System.out.println("Exception got when trying to access a temp queue outside its scope: " + e);
- }
- }
- finally {
- if (connection != null) {
- // Step 20. Be sure to close our JMS resources!
- connection.close();
- }
- if (initialContext != null) {
- // Step 21. Also close the initialContext!
- initialContext.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml b/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 2dd2df9..0000000
--- a/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,65 +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/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/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/21bf4406/examples/jms/temp-queue/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/temp-queue/src/main/resources/jndi.properties b/examples/jms/temp-queue/src/main/resources/jndi.properties
deleted file mode 100644
index 93537c4..0000000
--- a/examples/jms/temp-queue/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,20 +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.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616
-queue.queue/exampleQueue=exampleQueue