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/07/29 23:22:20 UTC
[14/24] activemq-artemis git commit: ARTEMIS-178 Refactor examples to
use CLI
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/topic-selector-example1/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/topic-selector-example1/pom.xml b/examples/jms/topic-selector-example1/pom.xml
index 7b5cafb..7526dd5 100644
--- a/examples/jms/topic-selector-example1/pom.xml
+++ b/examples/jms/topic-selector-example1/pom.xml
@@ -57,17 +57,13 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
</configuration>
</execution>
<execution>
@@ -77,14 +73,11 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.TopicSelectorExample1</clientClass>
+ <args>
+ <param>${basedir}/target/server0</param>
+ </args>
</configuration>
</execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
</executions>
<dependencies>
<dependency>
@@ -92,41 +85,7 @@ under the License.
<artifactId>artemis-jms-topic-selector-example1-example</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
</dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
</plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/topic-selector-example2/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/topic-selector-example2/pom.xml b/examples/jms/topic-selector-example2/pom.xml
index dab3620..320d13c 100644
--- a/examples/jms/topic-selector-example2/pom.xml
+++ b/examples/jms/topic-selector-example2/pom.xml
@@ -57,17 +57,13 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
</configuration>
</execution>
<execution>
@@ -77,14 +73,11 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.TopicSelectorExample2</clientClass>
+ <args>
+ <param>${basedir}/target/server0</param>
+ </args>
</configuration>
</execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
</executions>
<dependencies>
<dependency>
@@ -92,41 +85,7 @@ under the License.
<artifactId>artemis-jms-topic-selector-example2-example</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
</dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
</plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/topic/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/topic/pom.xml b/examples/jms/topic/pom.xml
index 3563009..0fe39ff 100644
--- a/examples/jms/topic/pom.xml
+++ b/examples/jms/topic/pom.xml
@@ -56,17 +56,13 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
</configuration>
</execution>
<execution>
@@ -77,16 +73,10 @@ under the License.
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.TopicExample</clientClass>
<args>
- <param>tcp://localhost:61616</param>
+ <param>${basedir}/target/server0</param>
</args>
</configuration>
</execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
</executions>
<dependencies>
<dependency>
@@ -94,41 +84,7 @@ under the License.
<artifactId>artemis-jms-topic-example</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
</dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
</plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/transaction-failover/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/transaction-failover/pom.xml b/examples/jms/transaction-failover/pom.xml
index d61bcd8..f954478 100644
--- a/examples/jms/transaction-failover/pom.xml
+++ b/examples/jms/transaction-failover/pom.xml
@@ -57,42 +57,25 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start0</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- <property>
- <name>udp-address</name>
- <value>${udp-address}</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <javaOptions>-Dudp-address=${udp-address}</javaOptions>
</configuration>
</execution>
<execution>
- <id>start1</id>
+ <id>create2</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <configurationDir>${basedir}/target/classes/activemq/server1</configurationDir>
- <fork>true</fork>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- <property>
- <name>udp-address</name>
- <value>${udp-address}</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server1</instance>
+ <configuration>${basedir}/target/classes/activemq/server1</configuration>
+ <javaOptions>-Dudp-address=${udp-address}</javaOptions>
</configuration>
</execution>
<execution>
@@ -102,30 +85,10 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.TransactionFailoverExample</clientClass>
- <systemProperties>
- <property>
- <name>exampleConfigDir</name>
- <value>${basedir}/target/classes/activemq</value>
- </property>
- </systemProperties>
- </configuration>
- </execution>
- <execution>
- <id>stop0</id>
- <goals>
- <goal>stop</goal>
- </goals>
- <configuration>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
- </execution>
- <execution>
- <id>stop1</id>
- <goals>
- <goal>stop</goal>
- </goals>
- <configuration>
- <configurationDir>${basedir}/target/classes/activemq/server1</configurationDir>
+ <args>
+ <param>${basedir}/target/server0</param>
+ <param>${basedir}/target/server1</param>
+ </args>
</configuration>
</execution>
</executions>
@@ -135,46 +98,7 @@ under the License.
<artifactId>artemis-jms-transaction-failover-example</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
</dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
- </configuration>
</plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml
index 1041aca..74a66d4 100644
--- a/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/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}/server0/data/messaging/bindings</bindings-directory>
+ <bindings-directory>../../data/messaging/bindings</bindings-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
+ <journal-directory>../../data/messaging/journal</journal-directory>
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>../../data/messaging/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>../../data/messaging/paging</paging-directory>
<ha-policy>
<shared-store>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml
index 27f33f6..62e5154 100644
--- a/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/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}/server0/data/messaging/bindings</bindings-directory>
+ <bindings-directory>../../data/messaging/bindings</bindings-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
+ <journal-directory>../../data/messaging/journal</journal-directory>
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>../../data/messaging/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>../../data/messaging/paging</paging-directory>
<ha-policy>
<shared-store>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/transactional/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/transactional/pom.xml b/examples/jms/transactional/pom.xml
index e7a629b..7461ed6 100644
--- a/examples/jms/transactional/pom.xml
+++ b/examples/jms/transactional/pom.xml
@@ -57,17 +57,13 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
</configuration>
</execution>
<execution>
@@ -77,14 +73,11 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.TransactionalExample</clientClass>
+ <args>
+ <param>${basedir}/target/server0</param>
+ </args>
</configuration>
</execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
</executions>
<dependencies>
<dependency>
@@ -92,41 +85,7 @@ under the License.
<artifactId>artemis-jms-transactional-example</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
</dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
</plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/xa-heuristic/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/xa-heuristic/pom.xml b/examples/jms/xa-heuristic/pom.xml
index 125bee7..da401e3 100644
--- a/examples/jms/xa-heuristic/pom.xml
+++ b/examples/jms/xa-heuristic/pom.xml
@@ -57,35 +57,14 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <!--we need to fork the server as we have system props that need set pre runtime-->
- <fork>true</fork>
- <systemProperties>
- <property>
- <name>com.sun.management.jmxremote</name>
- <value />
- </property>
- <property>
- <name>com.sun.management.jmxremote.port</name>
- <value>3001</value>
- </property>
- <property>
- <name>com.sun.management.jmxremote.ssl</name>
- <value>false</value>
- </property>
- <property>
- <name>com.sun.management.jmxremote.authenticate</name>
- <value>false</value>
- </property>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <javaOptions>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false</javaOptions>
</configuration>
</execution>
<execution>
@@ -95,14 +74,11 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.XAHeuristicExample</clientClass>
+ <args>
+ <param>${basedir}/target/server0</param>
+ </args>
</configuration>
</execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
</executions>
<dependencies>
<dependency>
@@ -110,45 +86,11 @@ under the License.
<artifactId>artemis-jms-xa-heuristic-example</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
</dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
</plugin>
</plugins>
</build>
-
</profile>
</profiles>
+
</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java
index 0cacdb2..09232e3 100644
--- a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java
+++ b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java
@@ -16,10 +16,6 @@
*/
package org.apache.activemq.artemis.jms.example;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.HashMap;
-
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
@@ -39,10 +35,13 @@ import javax.management.remote.JMXServiceURL;
import javax.naming.InitialContext;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
-import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.utils.UUIDGenerator;
/**
@@ -104,8 +103,7 @@ public class XAHeuristicExample extends ActiveMQExample
TextMessage worldMessage = session.createTextMessage("world");
// Step 12. create a transaction
- Xid xid1 =
- new DummyXid("xa-example1".getBytes(StandardCharsets.ISO_8859_1), 1, UUIDGenerator.getInstance()
+ Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.ISO_8859_1), 1, UUIDGenerator.getInstance()
.generateStringUUID()
.getBytes());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/xa-receive/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/xa-receive/pom.xml b/examples/jms/xa-receive/pom.xml
index b3d6c6e..5fa068a 100644
--- a/examples/jms/xa-receive/pom.xml
+++ b/examples/jms/xa-receive/pom.xml
@@ -57,17 +57,13 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <systemProperties>
- <property>
- <name>data.dir</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
</configuration>
</execution>
<execution>
@@ -76,15 +72,12 @@ under the License.
<goal>runClient</goal>
</goals>
<configuration>
- <clientClass>org.apache.activemq.artemis.jms.example.XAReceiveExample</clientClass>
+ <clientClass>org.apache.activemq.artemis.jms.example.TransactionalExample</clientClass>
+ <args>
+ <param>${basedir}/target/server0</param>
+ </args>
</configuration>
</execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
</executions>
<dependencies>
<dependency>
@@ -92,45 +85,12 @@ under the License.
<artifactId>artemis-jms-xa-receive-example</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
</dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
+
</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java b/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java
index b624081..2671e54 100644
--- a/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java
+++ b/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java
@@ -16,8 +16,6 @@
*/
package org.apache.activemq.artemis.jms.example;
-import java.nio.charset.StandardCharsets;
-
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
@@ -29,9 +27,12 @@ import javax.jms.XASession;
import javax.naming.InitialContext;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import java.nio.charset.StandardCharsets;
-import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.common.example.ActiveMQExample;
+
+// Defined on xa-heuristic example, the maven dependency will take care of that
+import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.utils.UUIDGenerator;
/**
@@ -88,8 +89,7 @@ public class XAReceiveExample extends ActiveMQExample
TextMessage worldMessage = session.createTextMessage("world");
// Step 12. create a transaction
- Xid xid1 =
- new DummyXid("xa-example1".getBytes(StandardCharsets.US_ASCII), 1, UUIDGenerator.getInstance()
+ Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.US_ASCII), 1, UUIDGenerator.getInstance()
.generateStringUUID()
.getBytes());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java b/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java
index 556fb12..447fbc4 100644
--- a/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java
+++ b/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java
@@ -16,9 +16,6 @@
*/
package org.apache.activemq.artemis.jms.example;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
@@ -33,9 +30,11 @@ import javax.jms.XASession;
import javax.naming.InitialContext;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
-import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.utils.UUIDGenerator;
/**
@@ -95,8 +94,7 @@ public class XASendExample extends ActiveMQExample
TextMessage worldMessage = session.createTextMessage("world");
// Step 12. create a transaction
- Xid xid1 =
- new DummyXid("xa-example1".getBytes(StandardCharsets.UTF_8), 1, UUIDGenerator.getInstance()
+ Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.UTF_8), 1, UUIDGenerator.getInstance()
.generateStringUUID()
.getBytes());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/soak/normal/README
----------------------------------------------------------------------
diff --git a/examples/soak/normal/README b/examples/soak/normal/README
index 54ec245..b69a1ac 100644
--- a/examples/soak/normal/README
+++ b/examples/soak/normal/README
@@ -5,22 +5,18 @@
Running the Soak Tests
=======================
-The default soak tests with start a ActiveMQ Artemis instance, 1 producer and 1 consumer. To run the default suite.
-
- $mvn verify
-
Run The Server Standalone
==========================
-If would like to run a number of servers or run the server on a different machine:
+Use the Profile server
+ mvn -Pserver verify
+
+That will create a server under ./target/server0
-To run server using the default configuration (server0, using localhost):
- $ mvn verify -Pserver
-To run multiple servers, you can specify the server configuration directory using server.dir
-system property (which defaults to server0). To run a 2nd server with a configuration stored in server1:
+You can define the property server.dir under the same Profile to create other servers. or you could do it manually if desired using the regular ./artemis create
- $ mvn verify -Pserver -Dserver.dir=server1
+ $ mvn -Dserver.dir=server1 -Pserver verify
server1 should contain a copy of configuration equivalent to that found under the server0 director with different
settings.
@@ -32,6 +28,9 @@ change:
$ mvn verify -P server
+
+To run the server just start it manually
+
Configure Server Dump
=====================
@@ -61,7 +60,7 @@ The clients can be run separate from the server using:
Parameters are specified in soak.properties.
-The duration of the tests is configured by duration-in-minutes (defaults to 2 minutes, set to
+The duration of the tests is configured by duration-in-minutes (defaults to 2 minutes, set to
-1 to run the test indefinitely).
To configure the soak properties different to the defaults for the clients, use the system property
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/soak/normal/pom.xml
----------------------------------------------------------------------
diff --git a/examples/soak/normal/pom.xml b/examples/soak/normal/pom.xml
index e35be5a..61d7866 100644
--- a/examples/soak/normal/pom.xml
+++ b/examples/soak/normal/pom.xml
@@ -44,49 +44,9 @@ under the License.
<activemq.basedir>${project.basedir}/../../..</activemq.basedir>
</properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.example.soak</groupId>
- <artifactId>artemis-jms-soak-example</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <systemProperties>
- <property>
- <name>build.directory</name>
- <value>${basedir}/target/</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<profiles>
<profile>
- <id>local</id>
+ <id>server</id>
<build>
<plugins>
<plugin>
@@ -94,15 +54,35 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>start</id>
+ <id>create</id>
<goals>
- <goal>start</goal>
+ <goal>create</goal>
</goals>
<configuration>
- <fork>true</fork>
- <configurationDir>${server.dir}</configurationDir>
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/server0</configuration>
</configuration>
</execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq.examples.soak</groupId>
+ <artifactId>artemis-jms-soak-example</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>local</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-maven-plugin</artifactId>
+ <executions>
<execution>
<id>runConsumer</id>
<goals>
@@ -110,9 +90,6 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.soak.example.SoakReceiver</clientClass>
- <args>
- <param>tcp://localhost:61616</param>
- </args>
</configuration>
</execution>
<execution>
@@ -122,21 +99,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.soak.example.SoakSender</clientClass>
- <args>
- <param>tcp://localhost:61616</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>stop</goal>
- </goals>
- <configuration>
- <configurationDir>${server.dir}</configurationDir>
</configuration>
</execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq.examples.soak</groupId>
+ <artifactId>artemis-jms-soak-example</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</build>
@@ -174,34 +146,17 @@ under the License.
</configuration>
</execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq.example.soak</groupId>
+ <artifactId>artemis-jms-soak-example</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</build>
</profile>
- <profile>
- <id>server</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>start</id>
- <goals>
- <goal>start</goal>
- </goals>
- <configuration>
- <configurationDir>${server.dir}</configurationDir>
- <fork>true</fork>
- <waitOnStart>true</waitOnStart>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/soak/normal/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/soak/normal/server0/broker.xml b/examples/soak/normal/server0/broker.xml
index 7f1f435..76df21f 100644
--- a/examples/soak/normal/server0/broker.xml
+++ b/examples/soak/normal/server0/broker.xml
@@ -17,7 +17,6 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
@@ -26,12 +25,12 @@ under the License.
</jms>
<core xmlns="urn:activemq:core">
<connectors>
- <connector name="netty-connector">tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576?tcpReceiveBufferSize=1048576</connector>
+ <connector name="netty-connector">tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576?tcpReceiveBufferSize=1048576 </acceptor>
+ <acceptor name="netty-acceptor">tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576</acceptor>
</acceptors>
<security-enabled>false</security-enabled>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java
----------------------------------------------------------------------
diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java
index 62ab65c..c903831 100644
--- a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java
+++ b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java
@@ -16,13 +16,6 @@
*/
package org.apache.activemq.artemis.jms.soak.example;
-import java.lang.Override;
-import java.lang.Runnable;
-import java.util.Hashtable;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Logger;
-
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
@@ -34,6 +27,9 @@ import javax.jms.MessageListener;
import javax.jms.Session;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Logger;
public class SoakReceiver
{
@@ -49,25 +45,13 @@ public class SoakReceiver
public void run()
{
- String jndiURL = System.getProperty("jndi.address");
- if(jndiURL == null)
- {
- jndiURL = args.length > 0 ? args[0] : "tcp://localhost:61616";
- }
-
- System.out.println("Connecting to JNDI at " + jndiURL);
-
try
{
String fileName = SoakBase.getPerfFileName();
SoakParams params = SoakBase.getParams(fileName);
- Hashtable<String, String> jndiProps = new Hashtable<String, String>();
- jndiProps.put("connectionFactory.ConnectionFactory", jndiURL);
- jndiProps.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
-
- final SoakReceiver receiver = new SoakReceiver(jndiProps, params);
+ final SoakReceiver receiver = new SoakReceiver(params);
Runtime.getRuntime().addShutdownHook(new Thread()
{
@@ -91,8 +75,6 @@ public class SoakReceiver
t.start();
}
- private final Hashtable<String, String> jndiProps;
-
private final SoakParams perfParams;
private final ExceptionListener exceptionListener = new ExceptionListener()
@@ -149,9 +131,8 @@ public class SoakReceiver
private Connection connection;
- private SoakReceiver(final Hashtable<String, String> jndiProps, final SoakParams perfParams)
+ private SoakReceiver(final SoakParams perfParams)
{
- this.jndiProps = jndiProps;
this.perfParams = perfParams;
}
@@ -210,7 +191,7 @@ public class SoakReceiver
InitialContext ic = null;
try
{
- ic = new InitialContext(jndiProps);
+ ic = new InitialContext();
ConnectionFactory factory = (ConnectionFactory)ic.lookup(perfParams.getConnectionFactoryLookup());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java
----------------------------------------------------------------------
diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java
index 567a72b..2e81de6 100644
--- a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java
+++ b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java
@@ -16,10 +16,6 @@
*/
package org.apache.activemq.artemis.jms.soak.example;
-import java.util.Hashtable;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Logger;
-
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -31,6 +27,8 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Logger;
import org.apache.activemq.artemis.utils.TokenBucketLimiter;
import org.apache.activemq.artemis.utils.TokenBucketLimiterImpl;
@@ -41,24 +39,12 @@ public class SoakSender
public static void main(final String[] args)
{
- String jndiURL = System.getProperty("jndi.address");
- if(jndiURL == null)
- {
- jndiURL = args.length > 0 ? args[0] : "tcp://localhost:61616";
- }
-
- System.out.println("Connecting to JNDI at " + jndiURL);
try
{
String fileName = SoakBase.getPerfFileName();
SoakParams params = SoakBase.getParams(fileName);
-
- Hashtable<String, String> jndiProps = new Hashtable<String, String>();
- jndiProps.put("connectionFactory.ConnectionFactory", jndiURL);
- jndiProps.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
-
- final SoakSender sender = new SoakSender(jndiProps, params);
+ final SoakSender sender = new SoakSender(params);
Runtime.getRuntime().addShutdownHook(new Thread()
{
@@ -79,8 +65,6 @@ public class SoakSender
private final SoakParams perfParams;
- private final Hashtable<String, String> jndiProps;
-
private Connection connection;
private Session session;
@@ -98,9 +82,8 @@ public class SoakSender
};
- private SoakSender(final Hashtable<String, String> jndiProps, final SoakParams perfParams)
+ private SoakSender(final SoakParams perfParams)
{
- this.jndiProps = jndiProps;
this.perfParams = perfParams;
}
@@ -207,7 +190,7 @@ public class SoakSender
InitialContext ic = null;
try
{
- ic = new InitialContext(jndiProps);
+ ic = new InitialContext();
ConnectionFactory factory = (ConnectionFactory)ic.lookup(perfParams.getConnectionFactoryLookup());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b3af4bb7/examples/soak/normal/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/soak/normal/src/main/resources/jndi.properties b/examples/soak/normal/src/main/resources/jndi.properties
new file mode 100644
index 0000000..93537c4
--- /dev/null
+++ b/examples/soak/normal/src/main/resources/jndi.properties
@@ -0,0 +1,20 @@
+# 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