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:15 UTC
[09/24] activemq-artemis git commit: Continuing work on ARTEMIS-178
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/delayed-redelivery/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/delayed-redelivery/pom.xml b/examples/jms/delayed-redelivery/pom.xml
index 4264468..764efda 100644
--- a/examples/jms/delayed-redelivery/pom.xml
+++ b/examples/jms/delayed-redelivery/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</dependency>
@@ -61,9 +56,18 @@ under the License.
<goals>
<goal>create</goal>
</goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
</configuration>
</execution>
<execution>
@@ -73,8 +77,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.DelayedRedeliveryExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
<args>
- <param>${basedir}/target/server0</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java b/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java
index 54e3b53..6a2d15d 100644
--- a/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java
+++ b/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java
@@ -25,23 +25,15 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* This example demonstrates how ActiveMQ Artemis can be configured with a redelivery delay in the event a message
* is redelivered.
*
* Please see the readme.html for more information
*/
-public class DelayedRedeliveryExample extends ActiveMQExample
+public class DelayedRedeliveryExample
{
- public static void main(final String[] args)
- {
- new DelayedRedeliveryExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -96,7 +88,7 @@ public class DelayedRedeliveryExample extends ActiveMQExample
if (messageReceived != null)
{
- return false;
+ throw new IllegalStateException("Expected to recieve message.");
}
System.out.println("Redelivery has been delayed so received message is " + messageReceived);
@@ -118,13 +110,11 @@ public class DelayedRedeliveryExample extends ActiveMQExample
long end = System.currentTimeMillis();
System.out.println("3nd delivery from " + queue.getQueueName() +
- ": " +
- messageReceived.getText() +
- " after " +
- (end - start) +
- " milliseconds.");
-
- return true;
+ ": " +
+ messageReceived.getText() +
+ " after " +
+ (end - start) +
+ " milliseconds.");
}
finally
{
@@ -139,5 +129,4 @@ public class DelayedRedeliveryExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml b/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml
index d23db3d..3e41664 100644
--- a/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml
@@ -32,13 +32,13 @@ under the License.
<core xmlns="urn:activemq:core">
- <bindings-directory>${data.dir}/server0/data/messaging/bindings</bindings-directory>
+ <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
+ <journal-directory>${data.dir:../data}/journal</journal-directory>
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>${data.dir:../data}/paging</paging-directory>
<!-- Acceptors -->
<acceptors>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/divert/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/divert/pom.xml b/examples/jms/divert/pom.xml
index 260569e..46dfbc6 100644
--- a/examples/jms/divert/pom.xml
+++ b/examples/jms/divert/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>${project.version}</version>
@@ -62,7 +57,7 @@ under the License.
<artifactId>artemis-maven-plugin</artifactId>
<executions>
<execution>
- <id>create</id>
+ <id>create0</id>
<goals>
<goal>create</goal>
</goals>
@@ -72,7 +67,7 @@ under the License.
</configuration>
</execution>
<execution>
- <id>create2</id>
+ <id>create1</id>
<goals>
<goal>create</goal>
</goals>
@@ -82,15 +77,64 @@ under the License.
</configuration>
</execution>
<execution>
+ <id>start0</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <spawn>true</spawn>
+ <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>
+ <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.DivertExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop0</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <location>${basedir}/target/server0</location>
+ <args>
+ <param>stop</param>
+ </args>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop1</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <location>${basedir}/target/server1</location>
<args>
- <param>${basedir}/target/server0</param>
- <param>${basedir}/target/server1</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java b/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java
index 503aadd..9cbaaa6 100644
--- a/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java
+++ b/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java
@@ -28,23 +28,15 @@ import javax.jms.Topic;
import javax.naming.InitialContext;
import java.util.Hashtable;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* This examples demonstrates the use of ActiveMQ Artemis "Diverts" to transparently divert or copy messages
* from one address to another.
*
* Please see the readme.html for more information.
*/
-public class DivertExample extends ActiveMQExample
+public class DivertExample
{
- public static void main(final String[] args)
- {
- new DivertExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connectionLondon = null;
@@ -58,7 +50,7 @@ public class DivertExample extends ActiveMQExample
// Step 1. Create an initial context to perform the JNDI lookup on the London server
Hashtable<String, Object> properties = new Hashtable<String, Object>();
properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
- properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1);
+ properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616");
properties.put("queue.queue/orders", "orders");
properties.put("topic.topic/priceUpdates", "priceUpdates");
properties.put("topic.topic/spyTopic", "spyTopic");
@@ -77,7 +69,7 @@ public class DivertExample extends ActiveMQExample
// Step 6. Create an initial context to perform the JNDI lookup on the New York server
properties = new Hashtable<String, Object>();
properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
- properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2);
+ properties.put("connectionFactory.ConnectionFactory2", "tcp://localhost:61617");
properties.put("topic.topic/newYorkPriceUpdates", "newYorkPriceUpdates");
initialContextNewYork = new InitialContext(properties);
@@ -94,7 +86,7 @@ public class DivertExample extends ActiveMQExample
ConnectionFactory cfLondon = (ConnectionFactory)initialContextLondon.lookup("ConnectionFactory");
// Step 9. Perform a lookup on the Connection Factory on the New York server
- ConnectionFactory cfNewYork = (ConnectionFactory)initialContextNewYork.lookup("ConnectionFactory");
+ ConnectionFactory cfNewYork = (ConnectionFactory)initialContextNewYork.lookup("ConnectionFactory2");
// Step 10. Create a JMS Connection on the London server
connectionLondon = cfLondon.createConnection();
@@ -181,7 +173,7 @@ public class DivertExample extends ActiveMQExample
if (priceUpdate1 != null)
{
- return false;
+ throw new IllegalStateException("Message is not null");
}
System.out.println("Did not received price update in New York, look it's: " + priceUpdate1);
@@ -190,7 +182,7 @@ public class DivertExample extends ActiveMQExample
if (priceUpdate2 != null)
{
- return false;
+ throw new IllegalStateException("Message is not null");
}
System.out.println("Did not received price update in New York, look it's: " + priceUpdate2);
@@ -211,7 +203,7 @@ public class DivertExample extends ActiveMQExample
if (message != null)
{
- return false;
+ throw new IllegalStateException("Message is not null");
}
System.out.println("Didn't receive local price update, look, it's: " + message);
@@ -231,8 +223,6 @@ public class DivertExample extends ActiveMQExample
System.out.println("Received forwarded price update on server 2: " + priceUpdate2.getText());
System.out.println("Time of forward: " + priceUpdate2.getLongProperty("time_of_forward"));
-
- return true;
}
finally
{
@@ -255,5 +245,4 @@ public class DivertExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/divert/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/divert/src/main/resources/activemq/server0/broker.xml b/examples/jms/divert/src/main/resources/activemq/server0/broker.xml
index 7c25065..7ce362a 100644
--- a/examples/jms/divert/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/divert/src/main/resources/activemq/server0/broker.xml
@@ -40,16 +40,13 @@ under the License.
<core xmlns="urn:activemq:core">
- <!-- We need to make it clustered otherwise the bridge won't deploy -->
+ <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
+ <journal-directory>${data.dir:../data}/journal</journal-directory>
- <bindings-directory>${data.dir}/server0/data/messaging/bindings</bindings-directory>
+ <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
-
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
-
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>${data.dir:../data}/paging</paging-directory>
<!-- Connectors -->
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/divert/src/main/resources/activemq/server1/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/divert/src/main/resources/activemq/server1/broker.xml b/examples/jms/divert/src/main/resources/activemq/server1/broker.xml
index d624897..315d13b 100644
--- a/examples/jms/divert/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/divert/src/main/resources/activemq/server1/broker.xml
@@ -32,13 +32,13 @@ under the License.
<core xmlns="urn:activemq:core">
- <bindings-directory>${data.dir}/server1/data/messaging/bindings</bindings-directory>
+ <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
- <journal-directory>${data.dir}/server1/data/messaging/journal</journal-directory>
+ <journal-directory>${data.dir:../data}/journal</journal-directory>
- <large-messages-directory>${data.dir}/server1/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server1/data/messaging/paging</paging-directory>
+ <paging-directory>${data.dir:../data}/paging</paging-directory>
<!-- Acceptors -->
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/durable-subscription/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/durable-subscription/pom.xml b/examples/jms/durable-subscription/pom.xml
index 1d408de..9571cd8 100644
--- a/examples/jms/durable-subscription/pom.xml
+++ b/examples/jms/durable-subscription/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</dependency>
@@ -61,9 +56,18 @@ under the License.
<goals>
<goal>create</goal>
</goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
</configuration>
</execution>
<execution>
@@ -73,8 +77,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.DurableSubscriptionExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
<args>
- <param>${basedir}/target/server0</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java b/examples/jms/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java
index c40cc69..2a8eabf 100644
--- a/examples/jms/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java
+++ b/examples/jms/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java
@@ -25,20 +25,12 @@ import javax.jms.Topic;
import javax.jms.TopicSubscriber;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS example that shows how to use a durable subscription.
*/
-public class DurableSubscriptionExample extends ActiveMQExample
+public class DurableSubscriptionExample
{
- public static void main(final String[] args)
- {
- new DurableSubscriptionExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -111,8 +103,6 @@ public class DurableSubscriptionExample extends ActiveMQExample
// Step 18. Delete the durable subscription
session.unsubscribe("subscriber-1");
-
- return true;
}
finally
{
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/durable-subscription/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/durable-subscription/src/main/resources/activemq/server0/broker.xml b/examples/jms/durable-subscription/src/main/resources/activemq/server0/broker.xml
index 6b661e4..2b2ba2e 100644
--- a/examples/jms/durable-subscription/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/durable-subscription/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.dir:../data}/bindings</bindings-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
+ <journal-directory>${data.dir:../data}/journal</journal-directory>
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>${data.dir:../data}/paging</paging-directory>
<!-- Acceptors -->
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/embedded-simple/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/embedded-simple/pom.xml b/examples/jms/embedded-simple/pom.xml
index 9836ff6..a1dae09 100644
--- a/examples/jms/embedded-simple/pom.xml
+++ b/examples/jms/embedded-simple/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
index c148dca..2bf15a2 100644
--- a/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
+++ b/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
@@ -16,6 +16,12 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.api.jms.JMSFactoryType;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.jms.server.JMSServerManager;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -27,81 +33,58 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
-import org.apache.activemq.artemis.jms.server.JMSServerManager;
-import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
-
/**
* This example demonstrates how to run an ActiveMQ Artemis embedded with JMS
*/
-public class EmbeddedExample extends ActiveMQExample
+public class EmbeddedExample
{
-
public static void main(final String[] args) throws Exception
{
- new EmbeddedExample().runExample();
- }
+ EmbeddedJMS jmsServer = new EmbeddedJMS();
- @Override
- public boolean runExample() throws Exception
- {
- try
- {
- EmbeddedJMS jmsServer = new EmbeddedJMS();
+ SecurityConfiguration securityConfig = new SecurityConfiguration();
+ securityConfig.addUser("guest", "guest");
+ securityConfig.addRole("guest", "guest");
+ securityConfig.setDefaultUser("guest");
+ jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig));
- SecurityConfiguration securityConfig = new SecurityConfiguration();
- securityConfig.addUser("guest", "guest");
- securityConfig.addRole("guest", "guest");
- securityConfig.setDefaultUser("guest");
- jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig));
+ jmsServer.start();
+ System.out.println("Started Embedded JMS Server");
- jmsServer.start();
- System.out.println("Started Embedded JMS Server");
+ JMSServerManager jmsServerManager = jmsServer.getJMSServerManager();
+ List<String> connectors = new ArrayList<String>();
+ connectors.add("in-vm");
+ jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");
+ jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue");
- JMSServerManager jmsServerManager = jmsServer.getJMSServerManager();
- List<String> connectors = new ArrayList<String>();
- connectors.add("in-vm");
- jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");
- jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue");
+ ConnectionFactory cf = (ConnectionFactory) jmsServer.lookup("ConnectionFactory");
+ Queue queue = (Queue) jmsServer.lookup("queue/exampleQueue");
- ConnectionFactory cf = (ConnectionFactory)jmsServer.lookup("ConnectionFactory");
- Queue queue = (Queue)jmsServer.lookup("queue/exampleQueue");
-
- // Step 10. Send and receive a message using JMS API
- Connection connection = null;
- try
+ // Step 10. Send and receive a message using JMS API
+ Connection connection = null;
+ try
+ {
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = session.createProducer(queue);
+ TextMessage message = session.createTextMessage("Hello sent at " + new Date());
+ System.out.println("Sending message: " + message.getText());
+ producer.send(message);
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+ connection.start();
+ TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000);
+ System.out.println("Received message:" + messageReceived.getText());
+ }
+ finally
+ {
+ if (connection != null)
{
- connection = cf.createConnection();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = session.createProducer(queue);
- TextMessage message = session.createTextMessage("Hello sent at " + new Date());
- System.out.println("Sending message: " + message.getText());
- producer.send(message);
- MessageConsumer messageConsumer = session.createConsumer(queue);
- connection.start();
- TextMessage messageReceived = (TextMessage)messageConsumer.receive(1000);
- System.out.println("Received message:" + messageReceived.getText());
+ connection.close();
}
- finally
- {
- if (connection != null)
- {
- connection.close();
- }
- // Step 11. Stop the JMS server
- jmsServer.stop();
- System.out.println("Stopped the JMS Server");
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- return false;
+ // Step 11. Stop the JMS server
+ jmsServer.stop();
+ System.out.println("Stopped the JMS Server");
}
- return true;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/embedded/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/embedded/pom.xml b/examples/jms/embedded/pom.xml
index e39c4a4..8d81f45 100644
--- a/examples/jms/embedded/pom.xml
+++ b/examples/jms/embedded/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
index 0c029ad..2a97c0f 100644
--- a/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
+++ b/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
@@ -27,7 +27,6 @@ import java.util.ArrayList;
import java.util.Date;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory;
@@ -43,95 +42,78 @@ import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
/**
* This example demonstrates how to run an ActiveMQ Artemis embedded with JMS
*/
-public final class EmbeddedExample extends ActiveMQExample
+public final class EmbeddedExample
{
public static void main(final String[] args) throws Exception
{
- new EmbeddedExample().runExample();
- }
-
- @Override
- public boolean runExample() throws Exception
- {
+ // Step 1. Create ActiveMQ Artemis core configuration, and set the properties accordingly
+ Configuration configuration = new ConfigurationImpl();
+ configuration.setPersistenceEnabled(false);
+ configuration.setJournalDirectory("target/data/journal");
+ configuration.setSecurityEnabled(false);
+ configuration.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
+
+ TransportConfiguration connectorConfig = new TransportConfiguration(NettyConnectorFactory.class.getName());
+
+ configuration.getConnectorConfigurations().put("connector", connectorConfig);
+
+
+ // Step 2. Create the JMS configuration
+ JMSConfiguration jmsConfig = new JMSConfigurationImpl();
+
+ // Step 3. Configure the JMS ConnectionFactory
+ ArrayList<String> connectorNames = new ArrayList<String>();
+ connectorNames.add("connector");
+ ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl()
+ .setName("cf")
+ .setConnectorNames(connectorNames)
+ .setBindings("cf");
+ jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
+
+ // Step 4. Configure the JMS Queue
+ JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl()
+ .setName("queue1")
+ .setDurable(false)
+ .setBindings("queue/queue1");
+ jmsConfig.getQueueConfigurations().add(queueConfig);
+
+ // Step 5. Start the JMS Server using the ActiveMQ Artemis core server and the JMS configuration
+ EmbeddedJMS jmsServer = new EmbeddedJMS();
+ jmsServer.setConfiguration(configuration);
+ jmsServer.setJmsConfiguration(jmsConfig);
+ jmsServer.start();
+ System.out.println("Started Embedded JMS Server");
+
+ // Step 6. Lookup JMS resources defined in the configuration
+ ConnectionFactory cf = (ConnectionFactory) jmsServer.lookup("cf");
+ Queue queue = (Queue) jmsServer.lookup("queue/queue1");
+
+ // Step 7. Send and receive a message using JMS API
+ Connection connection = null;
try
{
-
- // Step 1. Create ActiveMQ Artemis core configuration, and set the properties accordingly
- Configuration configuration = new ConfigurationImpl();
- configuration.setPersistenceEnabled(false);
- configuration.setJournalDirectory("target/data/journal");
- configuration.setSecurityEnabled(false);
- configuration.getAcceptorConfigurations()
- .add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
-
- TransportConfiguration connectorConfig = new TransportConfiguration(NettyConnectorFactory.class.getName());
-
- configuration.getConnectorConfigurations().put("connector", connectorConfig);
-
-
- // Step 2. Create the JMS configuration
- JMSConfiguration jmsConfig = new JMSConfigurationImpl();
-
- // Step 3. Configure the JMS ConnectionFactory
- ArrayList<String> connectorNames = new ArrayList<String>();
- connectorNames.add("connector");
- ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl()
- .setName("cf")
- .setConnectorNames(connectorNames)
- .setBindings("cf");
- jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
-
- // Step 4. Configure the JMS Queue
- JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl()
- .setName("queue1")
- .setDurable(false)
- .setBindings("queue/queue1");
- jmsConfig.getQueueConfigurations().add(queueConfig);
-
- // Step 5. Start the JMS Server using the ActiveMQ Artemis core server and the JMS configuration
- EmbeddedJMS jmsServer = new EmbeddedJMS();
- jmsServer.setConfiguration(configuration);
- jmsServer.setJmsConfiguration(jmsConfig);
- jmsServer.start();
- System.out.println("Started Embedded JMS Server");
-
- // Step 6. Lookup JMS resources defined in the configuration
- ConnectionFactory cf = (ConnectionFactory)jmsServer.lookup("cf");
- Queue queue = (Queue)jmsServer.lookup("queue/queue1");
-
- // Step 7. Send and receive a message using JMS API
- Connection connection = null;
- try
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = session.createProducer(queue);
+ TextMessage message = session.createTextMessage("Hello sent at " + new Date());
+ System.out.println("Sending message: " + message.getText());
+ producer.send(message);
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+ connection.start();
+ TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000);
+ System.out.println("Received message:" + messageReceived.getText());
+ }
+ finally
+ {
+ if (connection != null)
{
- connection = cf.createConnection();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = session.createProducer(queue);
- TextMessage message = session.createTextMessage("Hello sent at " + new Date());
- System.out.println("Sending message: " + message.getText());
- producer.send(message);
- MessageConsumer messageConsumer = session.createConsumer(queue);
- connection.start();
- TextMessage messageReceived = (TextMessage)messageConsumer.receive(1000);
- System.out.println("Received message:" + messageReceived.getText());
+ connection.close();
}
- finally
- {
- if (connection != null)
- {
- connection.close();
- }
- // Step 11. Stop the JMS server
- jmsServer.stop();
- System.out.println("Stopped the JMS Server");
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- return false;
+ // Step 11. Stop the JMS server
+ jmsServer.stop();
+ System.out.println("Stopped the JMS Server");
}
- return true;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/expiry/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/expiry/pom.xml b/examples/jms/expiry/pom.xml
index 6133af4..9c53999 100644
--- a/examples/jms/expiry/pom.xml
+++ b/examples/jms/expiry/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</dependency>
@@ -61,9 +56,18 @@ under the License.
<goals>
<goal>create</goal>
</goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
</configuration>
</execution>
<execution>
@@ -73,8 +77,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.ExpiryExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
<args>
- <param>${basedir}/target/server0</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java b/examples/jms/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java
index 026458c..dfb4324 100644
--- a/examples/jms/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java
+++ b/examples/jms/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java
@@ -25,20 +25,12 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* An example showing how messages are moved to an expiry queue when they expire.
*/
-public class ExpiryExample extends ActiveMQExample
+public class ExpiryExample
{
- public static void main(final String[] args)
- {
- new ExpiryExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -116,8 +108,6 @@ public class ExpiryExample extends ActiveMQExample
System.out.println("*Origin destination* of the expired message: " + messageReceived.getStringProperty("_AMQ_ORIG_ADDRESS"));
// Step 21. the actual expiration time is stored in the _AMQ_ACTUAL_EXPIRY property
System.out.println("*Actual expiration time* of the expired message: " + messageReceived.getLongProperty("_AMQ_ACTUAL_EXPIRY"));
-
- return true;
}
finally
{
@@ -132,5 +122,4 @@ public class ExpiryExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/expiry/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/expiry/src/main/resources/activemq/server0/broker.xml b/examples/jms/expiry/src/main/resources/activemq/server0/broker.xml
index 3333732..4907097 100644
--- a/examples/jms/expiry/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/expiry/src/main/resources/activemq/server0/broker.xml
@@ -32,13 +32,13 @@ under the License.
<core xmlns="urn:activemq:core">
- <bindings-directory>${data.dir}/server0/data/messaging/bindings</bindings-directory>
+ <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
+ <journal-directory>${data.dir:../data}/journal</journal-directory>
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>${data.dir:../data}/paging</paging-directory>
<!-- Acceptors -->
<acceptors>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/ha-policy-autobackup/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/ha-policy-autobackup/pom.xml b/examples/jms/ha-policy-autobackup/pom.xml
index 649adf0..cace530 100644
--- a/examples/jms/ha-policy-autobackup/pom.xml
+++ b/examples/jms/ha-policy-autobackup/pom.xml
@@ -37,8 +37,8 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-cli</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java
index 10f858f..d561750 100644
--- a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java
+++ b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java
@@ -16,6 +16,12 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
+import org.apache.activemq.artemis.api.core.client.TopologyMember;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -30,26 +36,17 @@ import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
-import org.apache.activemq.artemis.api.core.client.TopologyMember;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-
/**
* A simple example that demonstrates server side load-balancing of messages between the queue instances on different
* nodes of the cluster.
- *
*/
-public class HAPolicyAutoBackupExample extends ActiveMQExample
+public class HAPolicyAutoBackupExample
{
- public static void main(final String[] args) throws Exception
- {
- new HAPolicyAutoBackupExample().run(args);
- }
+ private static Process server0;
- @Override
- public boolean runExample() throws Exception
+ private static Process server1;
+
+ public static void main(final String[] args) throws Exception
{
Connection connection0 = null;
@@ -61,16 +58,19 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample
try
{
+ server0 = ServerUtil.startServer(args[0], HAPolicyAutoBackupExample.class.getSimpleName() + "0", 0, 5000);
+ server1 = ServerUtil.startServer(args[1], HAPolicyAutoBackupExample.class.getSimpleName() + "1", 1, 5000);
+
// Step 1. Get an initial context for looking up JNDI from server 0 and 1
Hashtable<String, Object> properties = new Hashtable<String, Object>();
properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
- properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1 + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
+ properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
properties.put("queue.queue/exampleQueue", "exampleQueue");
ic0 = new InitialContext(properties);
properties = new Hashtable<String, Object>();
properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
- properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2 + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
+ properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61617?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
ic1 = new InitialContext(properties);
// Step 2. Look-up the JMS Queue object from JNDI
@@ -99,7 +99,6 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample
MessageConsumer consumer0 = session0.createConsumer(queue);
MessageConsumer consumer1 = session1.createConsumer(queue);
-
// Step 11. We create a JMS MessageProducer object on server 0
MessageProducer producer = session0.createProducer(queue);
@@ -129,7 +128,7 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample
consumer1.close();
// Step 15.now kill server1, messages will be scaled down to server0
- killServer(1);
+ ServerUtil.killServer(server1);
Thread.sleep(40000);
// Step 16. we now receive the messages that were on server1 but were scaled down to server0
@@ -139,8 +138,6 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample
System.out.println("Got message: " + message0.getText() + " from node 1");
}
-
- return true;
}
finally
{
@@ -155,10 +152,13 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample
{
connection1.close();
}
+
+ ServerUtil.killServer(server0);
+ ServerUtil.killServer(server1);
}
}
- private void waitForBackups(ConnectionFactory cf0, int backups) throws InterruptedException
+ private static void waitForBackups(ConnectionFactory cf0, int backups) throws InterruptedException
{
final CountDownLatch latch = new CountDownLatch(backups);
((ActiveMQConnectionFactory) cf0).getServerLocator().addClusterTopologyListener(new ClusterTopologyListener()
@@ -181,5 +181,4 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample
});
latch.await(30000, TimeUnit.MILLISECONDS);
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/http-transport/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/http-transport/pom.xml b/examples/jms/http-transport/pom.xml
index b13f800..0d9c91d 100644
--- a/examples/jms/http-transport/pom.xml
+++ b/examples/jms/http-transport/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</dependency>
@@ -61,9 +56,18 @@ under the License.
<goals>
<goal>create</goal>
</goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:8080?http-enabled=true</testURI>
+ <args>
+ <param>run</param>
+ </args>
</configuration>
</execution>
<execution>
@@ -73,8 +77,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.HttpTransportExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
<args>
- <param>${basedir}/target/server0</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java b/examples/jms/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java
index 8348007..cd2e175 100644
--- a/examples/jms/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java
+++ b/examples/jms/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java
@@ -25,20 +25,12 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS Queue example that uses HTTP protocol.
*/
-public class HttpTransportExample extends ActiveMQExample
+public class HttpTransportExample
{
- public static void main(final String[] args)
- {
- new HttpTransportExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -84,8 +76,6 @@ public class HttpTransportExample extends ActiveMQExample
System.out.println("Received message: " + messageReceived.getText());
initialContext.close();
-
- return true;
}
finally
{
@@ -100,5 +90,4 @@ public class HttpTransportExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml b/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml
index f6062b6..ea39ccd 100644
--- a/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml
@@ -29,20 +29,18 @@ under the License.
<core xmlns="urn:activemq:core">
- <bindings-directory>${data.dir}/server0/data/messaging/bindings</bindings-directory>
+ <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
+ <journal-directory>${data.dir:../data}/journal</journal-directory>
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>${data.dir:../data}/paging</paging-directory>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:8080</acceptor>
- <!-- This is being defined just so the check-alive on the ArtemisExample super class works -->
- <acceptor name="netty-accepto-checkalive">tcp://localhost:61616</acceptor>
</acceptors>
<!-- Other config -->
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/instantiate-connection-factory/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/instantiate-connection-factory/pom.xml b/examples/jms/instantiate-connection-factory/pom.xml
index 17e5543..774b2b2 100644
--- a/examples/jms/instantiate-connection-factory/pom.xml
+++ b/examples/jms/instantiate-connection-factory/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-core-client</artifactId>
<version>${project.version}</version>
@@ -71,9 +66,18 @@ under the License.
<goals>
<goal>create</goal>
</goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
</configuration>
</execution>
<execution>
@@ -83,8 +87,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.InstantiateConnectionFactoryExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
<args>
- <param>${basedir}/target/server0</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java b/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java
index 85ee7d9..b0acce4 100644
--- a/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java
+++ b/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java
@@ -29,7 +29,6 @@ import java.util.Map;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
@@ -40,15 +39,9 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
*
* For more information please see the readme.html file.
*/
-public class InstantiateConnectionFactoryExample extends ActiveMQExample
+public class InstantiateConnectionFactoryExample
{
- public static void main(final String[] args)
- {
- new InstantiateConnectionFactoryExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
try
@@ -95,8 +88,6 @@ public class InstantiateConnectionFactoryExample extends ActiveMQExample
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
System.out.println("Received message: " + messageReceived.getText());
-
- return true;
}
finally
{
@@ -106,5 +97,4 @@ public class InstantiateConnectionFactoryExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml b/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094..0000000
--- a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:activemq"
- xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
-
- <jms xmlns="urn:activemq:jms">
- <!--the queue used by the example-->
- <queue name="exampleQueue"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>${data.dir}/server0/data/messaging/bindings</bindings-directory>
-
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
-
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
-
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
-
- <!-- Acceptors -->
- <acceptors>
- <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
- </acceptors>
-
- <!-- Other config -->
-
- <security-settings>
- <!--security for example queue-->
- <security-setting match="jms.queue.exampleQueue">
- <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/54d0d2b4/examples/jms/interceptor/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/interceptor/pom.xml b/examples/jms/interceptor/pom.xml
index 5d7a2a0..530a7b9 100644
--- a/examples/jms/interceptor/pom.xml
+++ b/examples/jms/interceptor/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>${project.version}</version>
@@ -66,9 +61,18 @@ under the License.
<goals>
<goal>create</goal>
</goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
</configuration>
</execution>
<execution>
@@ -78,8 +82,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.InterceptorExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
<args>
- <param>${basedir}/target/server0</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java b/examples/jms/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java
index f6e8d99..1a27726 100644
--- a/examples/jms/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java
+++ b/examples/jms/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java
@@ -25,20 +25,12 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS example that shows how to implement and use interceptors with ActiveMQ Artemis.
*/
-public class InterceptorExample extends ActiveMQExample
+public class InterceptorExample
{
- public static void main(final String[] args)
- {
- new InterceptorExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -66,8 +58,8 @@ public class InterceptorExample extends ActiveMQExample
TextMessage message = session.createTextMessage("This is a text message");
System.out.println("Sending message [" + message.getText() +
- "] with String property: " +
- message.getStringProperty("newproperty"));
+ "] with String property: " +
+ message.getStringProperty("newproperty"));
// Step 8. Send the Message
producer.send(message);
@@ -82,10 +74,8 @@ public class InterceptorExample extends ActiveMQExample
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
System.out.println("Received message [" + messageReceived.getText() +
- "] with String property: " +
- messageReceived.getStringProperty("newproperty"));
-
- return true;
+ "] with String property: " +
+ messageReceived.getStringProperty("newproperty"));
}
finally
{
@@ -100,5 +90,4 @@ public class InterceptorExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/interceptor/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/interceptor/src/main/resources/activemq/server0/broker.xml b/examples/jms/interceptor/src/main/resources/activemq/server0/broker.xml
index 1ff8a1f..fc82158 100644
--- a/examples/jms/interceptor/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/interceptor/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.dir:../data}/bindings</bindings-directory>
- <journal-directory>${data.dir}/server0/data/messaging/journal</journal-directory>
+ <journal-directory>${data.dir:../data}/journal</journal-directory>
- <large-messages-directory>${data.dir}/server0/data/messaging/largemessages</large-messages-directory>
+ <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
- <paging-directory>${data.dir}/server0/data/messaging/paging</paging-directory>
+ <paging-directory>${data.dir:../data}/paging</paging-directory>
<remoting-incoming-interceptors>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-auto-closeable/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-auto-closeable/pom.xml b/examples/jms/jms-auto-closeable/pom.xml
index 6cceae6..17376ab 100644
--- a/examples/jms/jms-auto-closeable/pom.xml
+++ b/examples/jms/jms-auto-closeable/pom.xml
@@ -37,11 +37,6 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</dependency>
@@ -61,9 +56,18 @@ under the License.
<goals>
<goal>create</goal>
</goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
</configuration>
</execution>
<execution>
@@ -73,8 +77,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.JMSAutoCloseableExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
<args>
- <param>${basedir}/target/server0</param>
+ <param>stop</param>
</args>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/artemis/jms/example/JMSAutoCloseableExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/artemis/jms/example/JMSAutoCloseableExample.java b/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/artemis/jms/example/JMSAutoCloseableExample.java
index 68bd1eb..555e8ff 100644
--- a/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/artemis/jms/example/JMSAutoCloseableExample.java
+++ b/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/artemis/jms/example/JMSAutoCloseableExample.java
@@ -18,21 +18,14 @@ package org.apache.activemq.artemis.jms.example;
import javax.jms.*;
import javax.naming.InitialContext;
-
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import java.lang.Exception;
/**
* A simple JMS example that shows how AutoCloseable is used by JMS 2 resources.
*/
-public class JMSAutoCloseableExample extends ActiveMQExample
+public class JMSAutoCloseableExample
{
- public static void main(final String[] args)
- {
- new JMSAutoCloseableExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
InitialContext initialContext = null;
try
@@ -48,9 +41,9 @@ public class JMSAutoCloseableExample extends ActiveMQExample
// Step 4.Create a JMS Context using the try-with-resources statement
try
- (
- JMSContext jmsContext = cf.createContext()
- )
+ (
+ JMSContext jmsContext = cf.createContext()
+ )
{
// Step 5. create a jms producer
JMSProducer jmsProducer = jmsContext.createProducer();
@@ -64,8 +57,6 @@ public class JMSAutoCloseableExample extends ActiveMQExample
//JMSCcontext will have been closed by the time we get to this point
System.out.println("expected exception from jmsProducer.send: " + e.getMessage());
}
-
- return true;
}
finally
{