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:14 UTC
[08/24] activemq-artemis git commit: Continuing work on ARTEMIS-178
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/jms-auto-closeable/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/jms-auto-closeable/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/jms-auto-closeable/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/jms-auto-closeable/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/broker.xml b/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 0f0eebc..0000000
--- a/examples/jms/jms-auto-closeable/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,59 +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, note we have removed send privs-->
- <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"/>
- </security-setting>
- </security-settings>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-bridge/pom.xml b/examples/jms/jms-bridge/pom.xml
index 54ea63e..ac21a8c 100644
--- a/examples/jms/jms-bridge/pom.xml
+++ b/examples/jms/jms-bridge/pom.xml
@@ -27,7 +27,7 @@ under the License.
<version>1.0.1-SNAPSHOT</version>
</parent>
- <artifactId>artemis-jms-jms-bridge-example</artifactId>
+ <artifactId>artemis-jms-bridge-example</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Bridge Example</name>
@@ -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-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,65 @@ under the License.
</configuration>
</execution>
<execution>
+ <id>start0</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <spawn>true</spawn>
+ <location>${basedir}/target/server0</location>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
+ <name>server0</name>
+ </configuration>
+ </execution>
+ <execution>
+ <id>start1</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <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.JMSBridgeExample</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>
@@ -98,7 +143,7 @@ under the License.
<dependencies>
<dependency>
<groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>artemis-jms-jms-bridge-example</artifactId>
+ <artifactId>artemis-jms-bridge-example</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
index 659d37b..13d30e7 100644
--- a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
+++ b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
@@ -27,7 +27,6 @@ import javax.jms.Topic;
import javax.naming.InitialContext;
import java.util.Hashtable;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
import org.apache.activemq.artemis.jms.bridge.JMSBridge;
import org.apache.activemq.artemis.jms.bridge.QualityOfServiceMode;
import org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl;
@@ -39,22 +38,16 @@ import org.apache.activemq.artemis.jms.bridge.impl.JNDIDestinationFactory;
* The source and target destinations are located on 2 different ActiveMQ Artemis server.
* The source and target queues are bridged by a JMS Bridge configured and running on the "target" server.
*/
-public class JMSBridgeExample extends ActiveMQExample
+public class JMSBridgeExample
{
public static void main(final String[] args) throws Exception
{
- new JMSBridgeExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
- {
- String sourceServer = ActiveMQExample.DEFAULT_TCP1;
- String targetServer = ActiveMQExample.DEFAULT_TCP2;
+ String sourceServer = "tcp://localhost:61616";
+ String targetServer = "tcp://localhost:61617";
System.out.println("client will publish messages to " + sourceServer +
- " and receives message from " +
- targetServer);
+ " and receives message from " +
+ targetServer);
// Step 1. Create JNDI contexts for source and target servers
InitialContext sourceContext = JMSBridgeExample.createContext(sourceServer);
@@ -65,23 +58,23 @@ public class JMSBridgeExample extends ActiveMQExample
// Step 2. Create and start a JMS Bridge
// Note, the Bridge needs a transaction manager, in this instance we will use the JBoss TM
JMSBridge jmsBridge = new JMSBridgeImpl(
- new JNDIConnectionFactoryFactory(sourceJndiParams, "ConnectionFactory"),
- new JNDIConnectionFactoryFactory(targetJndiParams, "ConnectionFactory"),
- new JNDIDestinationFactory(sourceJndiParams, "source/topic"),
- new JNDIDestinationFactory(targetJndiParams, "target/queue"),
- null,
- null,
- null,
- null,
- null,
- 5000,
- 10,
- QualityOfServiceMode.DUPLICATES_OK,
- 1,
- -1,
- null,
- null,
- true);
+ new JNDIConnectionFactoryFactory(sourceJndiParams, "ConnectionFactory"),
+ new JNDIConnectionFactoryFactory(targetJndiParams, "ConnectionFactory"),
+ new JNDIDestinationFactory(sourceJndiParams, "source/topic"),
+ new JNDIDestinationFactory(targetJndiParams, "target/queue"),
+ null,
+ null,
+ null,
+ null,
+ null,
+ 5000,
+ 10,
+ QualityOfServiceMode.DUPLICATES_OK,
+ 1,
+ -1,
+ null,
+ null,
+ true);
Connection sourceConnection = null;
Connection targetConnection = null;
@@ -135,7 +128,7 @@ public class JMSBridgeExample extends ActiveMQExample
// Step 12. Be sure to close the resources!
if(jmsBridge != null)
{
- jmsBridge.stop();
+ jmsBridge.stop();
}
if (sourceContext != null)
{
@@ -154,8 +147,6 @@ public class JMSBridgeExample extends ActiveMQExample
targetConnection.close();
}
}
-
- return true;
}
private static InitialContext createContext(final String server) throws Exception
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-bridge/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-bridge/src/main/resources/activemq/server0/broker.xml b/examples/jms/jms-bridge/src/main/resources/activemq/server0/broker.xml
index d1e96e7..df456d7 100644
--- a/examples/jms/jms-bridge/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/jms-bridge/src/main/resources/activemq/server0/broker.xml
@@ -28,13 +28,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>
<acceptor name="netty">tcp://localhost:61616</acceptor>
@@ -50,4 +50,4 @@ under the License.
</security-settings>
</core>
</configuration>
-
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml b/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml
index aada805..e65720c 100644
--- a/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml
@@ -28,17 +28,16 @@ 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>
- <acceptor name="netty">tcp://localhost:5455</acceptor>
- <acceptor name="netty2">tcp://localhost:61617</acceptor>
+ <acceptor name="netty">tcp://localhost:61617</acceptor>
</acceptors>
<security-settings>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-completion-listener/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-completion-listener/pom.xml b/examples/jms/jms-completion-listener/pom.xml
index 042b3de..ef5fb76 100644
--- a/examples/jms/jms-completion-listener/pom.xml
+++ b/examples/jms/jms-completion-listener/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.JMSCompletionListenerExample</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-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java b/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java
index a166000..47a61cb 100644
--- a/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java
+++ b/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java
@@ -24,23 +24,17 @@ import javax.jms.Message;
import javax.jms.Queue;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
+import java.lang.Exception;
+import java.lang.IllegalStateException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
* A JMS Completion Listener Example.
*/
-public class JMSCompletionListenerExample extends ActiveMQExample
+public class JMSCompletionListenerExample
{
- public static void main(final String[] args)
- {
- new JMSCompletionListenerExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
InitialContext initialContext = null;
JMSContext jmsContext = null;
@@ -84,7 +78,10 @@ public class JMSCompletionListenerExample extends ActiveMQExample
producer.send(queue, "this is a string");
//Step 7. wait for the Completion handler
- return latch.await(5, TimeUnit.SECONDS);
+ if (!latch.await(5, TimeUnit.SECONDS))
+ {
+ throw new IllegalStateException("Completion listener not called as expected.");
+ }
}
finally
{
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-completion-listener/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-completion-listener/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/jms-completion-listener/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/jms-completion-listener/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/jms-completion-listener/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-completion-listener/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/jms-completion-listener/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/jms-completion-listener/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/jms-completion-listener/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-completion-listener/src/main/resources/activemq/server0/broker.xml b/examples/jms/jms-completion-listener/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094..0000000
--- a/examples/jms/jms-completion-listener/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/jms-context/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-context/pom.xml b/examples/jms/jms-context/pom.xml
index 7363d88..d586367 100644
--- a/examples/jms/jms-context/pom.xml
+++ b/examples/jms/jms-context/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.JMSContextExample</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-context/src/main/java/org/apache/activemq/artemis/jms/example/JMSContextExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/jms-context/src/main/java/org/apache/activemq/artemis/jms/example/JMSContextExample.java b/examples/jms/jms-context/src/main/java/org/apache/activemq/artemis/jms/example/JMSContextExample.java
index 81e7a9d..bb8457f 100644
--- a/examples/jms/jms-context/src/main/java/org/apache/activemq/artemis/jms/example/JMSContextExample.java
+++ b/examples/jms/jms-context/src/main/java/org/apache/activemq/artemis/jms/example/JMSContextExample.java
@@ -21,21 +21,14 @@ import javax.jms.DeliveryMode;
import javax.jms.JMSContext;
import javax.jms.Queue;
import javax.naming.InitialContext;
-
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import java.lang.Exception;
/**
* A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
*/
-public class JMSContextExample extends ActiveMQExample
+public class JMSContextExample
{
- public static void main(final String[] args)
- {
- new JMSContextExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
InitialContext initialContext = null;
JMSContext jmsContext = null;
@@ -60,8 +53,6 @@ public class JMSContextExample extends ActiveMQExample
String payLoad = jmsContext.createConsumer(queue).receiveBody(String.class);
System.out.println("payLoad = " + payLoad);
-
- return true;
}
finally
{
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-context/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-context/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/jms-context/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/jms-context/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/jms-context/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-context/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/jms-context/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/jms-context/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/jms-context/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-context/src/main/resources/activemq/server0/broker.xml b/examples/jms/jms-context/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094..0000000
--- a/examples/jms/jms-context/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/jms-shared-consumer/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-shared-consumer/pom.xml b/examples/jms/jms-shared-consumer/pom.xml
index 5939114..af55f86 100644
--- a/examples/jms/jms-shared-consumer/pom.xml
+++ b/examples/jms/jms-shared-consumer/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.JMSSharedConsumerExample</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-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java b/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java
index 5c50063..c45f79b 100644
--- a/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java
+++ b/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java
@@ -23,21 +23,13 @@ import javax.jms.JMSProducer;
import javax.jms.Topic;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A JMS Example that uses shared consumers.
*/
-public class JMSSharedConsumerExample extends ActiveMQExample
+public class JMSSharedConsumerExample
{
public static void main(final String[] args) throws Exception
{
- new JMSSharedConsumerExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
- {
InitialContext initialContext = null;
JMSContext jmsContext = null;
JMSContext jmsContext2 = null;
@@ -80,8 +72,6 @@ public class JMSSharedConsumerExample extends ActiveMQExample
body = jmsConsumer2.receiveBody(String.class, 5000);
System.out.println("body = " + body);
-
- return true;
}
finally
{
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml b/examples/jms/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml
index 0ee3f9d..2b2ba2e 100644
--- a/examples/jms/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml
@@ -29,15 +29,16 @@ 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:61616</acceptor>
</acceptors>
@@ -45,7 +46,7 @@ under the License.
<!-- Other config -->
<security-settings>
- <!--security for example queue-->
+ <!--security for example topic-->
<security-setting match="jms.topic.exampleTopic">
<permission type="createDurableQueue" roles="guest"/>
<permission type="deleteDurableQueue" roles="guest"/>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/jmx/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/jmx/pom.xml b/examples/jms/jmx/pom.xml
index f9a3e9a..802025d 100644
--- a/examples/jms/jmx/pom.xml
+++ b/examples/jms/jmx/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>
@@ -77,14 +72,35 @@ under the License.
</configuration>
</execution>
<execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
+ </configuration>
+ </execution>
+ <execution>
<id>runClient</id>
<goals>
<goal>runClient</goal>
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.JMXExample</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/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java b/examples/jms/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
index ebdad1b..8d36d53 100644
--- a/examples/jms/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
+++ b/examples/jms/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
@@ -36,22 +36,15 @@ import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
/**
* An example that shows how to manage ActiveMQ Artemis using JMX.
*/
-public class JMXExample extends ActiveMQExample
+public class JMXExample
{
private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi";
- public static void main(final String[] args)
- {
- new JMXExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
QueueConnection connection = null;
InitialContext initialContext = null;
@@ -94,7 +87,7 @@ public class JMXExample extends ActiveMQExample
// Step 12. Create a JMSQueueControl proxy to manage the queue on the server
JMSQueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc,
on,
- JMSQueueControl.class,
+ JMSQueueControl.class,
false);
// Step 13. Display the number of messages in the queue
System.out.println(queueControl.getName() + " contains " + queueControl.getMessageCount() + " messages");
@@ -119,8 +112,6 @@ public class JMXExample extends ActiveMQExample
// The call will timeout after 5000ms and messageReceived will be null
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
System.out.println("Received message: " + messageReceived);
-
- return true;
}
finally
{
@@ -135,5 +126,4 @@ public class JMXExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/large-message/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/large-message/pom.xml b/examples/jms/large-message/pom.xml
index dd3af5b..cc354e6 100644
--- a/examples/jms/large-message/pom.xml
+++ b/examples/jms/large-message/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>
@@ -61,10 +61,6 @@ under the License.
<goals>
<goal>create</goal>
</goals>
- <configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
- </configuration>
</execution>
<execution>
<id>runClient</id>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java b/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java
index d154ed7..b7cf3de 100644
--- a/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java
+++ b/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -32,19 +34,12 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* This example demonstrates the ability of ActiveMQ Artemis to send and consume a very large message, much
* bigger than can fit in RAM.
*/
-public class LargeMessageExample extends ActiveMQExample
+public class LargeMessageExample
{
- public static void main(final String[] args)
- {
- new LargeMessageExample().run(args);
- }
-
/**
* The message we will send is size 2GiB, even though we are only running in 50MB of RAM on both
* client and server.
@@ -54,14 +49,16 @@ public class LargeMessageExample extends ActiveMQExample
*/
private static final long FILE_SIZE = 2L * 1024 * 1024 * 1024; // 2 GiB message
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ Process server = null;
Connection connection = null;
InitialContext initialContext = null;
try
{
+ server = ServerUtil.startServer(args[0], LargeMessageExample.class.getSimpleName(), 0, 5000);
+
// Step 1. Create an initial context to perform the JNDI lookup.
initialContext = new InitialContext();
@@ -83,8 +80,8 @@ public class LargeMessageExample extends ActiveMQExample
// Step 5. Create a huge file - this will form the body of the message we will send.
System.out.println("Creating a file to send of size " + FILE_SIZE +
- " bytes. This may take a little while... " +
- "If this is too big for your disk you can easily change the FILE_SIZE in the example.");
+ " bytes. This may take a little while... " +
+ "If this is too big for your disk you can easily change the FILE_SIZE in the example.");
File fileInput = new File("huge_message_to_send.dat");
@@ -122,12 +119,9 @@ public class LargeMessageExample extends ActiveMQExample
initialContext.close();
- killServer(0);
-
- // Give the server a little time to shutdown properly
- Thread.sleep(5000);
+ ServerUtil.killServer(server);
- reStartServer(0, 60000);
+ server = ServerUtil.startServer(args[0], "LargeMessageExample", 0, 5000);
System.out.println("Server restarted.");
@@ -154,7 +148,7 @@ public class LargeMessageExample extends ActiveMQExample
BytesMessage messageReceived = (BytesMessage)messageConsumer.receive(120000);
System.out.println("Received message with: " + messageReceived.getLongProperty("_AMQ_LARGE_SIZE") +
- " bytes. Now streaming to file on disk.");
+ " bytes. Now streaming to file on disk.");
// Step 13. We set an OutputStream on the message. This causes the message body to be written to the
// OutputStream until there are no more bytes to be written.
@@ -174,8 +168,6 @@ public class LargeMessageExample extends ActiveMQExample
fileOutputStream.close();
System.out.println("File streamed to disk. Size of received file on disk is " + outputFile.length());
-
- return true;
}
finally
{
@@ -189,6 +181,8 @@ public class LargeMessageExample extends ActiveMQExample
{
connection.close();
}
+
+ ServerUtil.killServer(server);
}
}
@@ -198,7 +192,7 @@ public class LargeMessageExample extends ActiveMQExample
* @throws FileNotFoundException
* @throws IOException
*/
- private void createFile(final File file, final long fileSize) throws IOException
+ private static void createFile(final File file, final long fileSize) throws IOException
{
FileOutputStream fileOut = new FileOutputStream(file);
BufferedOutputStream buffOut = new BufferedOutputStream(fileOut);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/large-message/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/large-message/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/large-message/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/large-message/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/large-message/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/large-message/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/large-message/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/large-message/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/large-message/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/large-message/src/main/resources/activemq/server0/broker.xml b/examples/jms/large-message/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094..0000000
--- a/examples/jms/large-message/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/last-value-queue/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/last-value-queue/pom.xml b/examples/jms/last-value-queue/pom.xml
index 61f9b7b..15e9d38 100644
--- a/examples/jms/last-value-queue/pom.xml
+++ b/examples/jms/last-value-queue/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.LastValueQueueExample</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/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java b/examples/jms/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java
index ed0b6f8..72b001b 100644
--- a/examples/jms/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java
+++ b/examples/jms/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java
@@ -28,21 +28,13 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* This example shows how to configure and use a <em>Last-Value</em> queues.
* Only the last message with a well-defined property is hold by the queue.
*/
-public class LastValueQueueExample extends ActiveMQExample
+public class LastValueQueueExample
{
- public static void main(final String[] args)
- {
- new LastValueQueueExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -108,8 +100,6 @@ public class LastValueQueueExample extends ActiveMQExample
System.out.format("Received message: %s%n", messageReceived);
initialContext.close();
-
- return true;
}
finally
{
@@ -124,5 +114,4 @@ public class LastValueQueueExample extends ActiveMQExample
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/management-notifications/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/management-notifications/pom.xml b/examples/jms/management-notifications/pom.xml
index 9e023e0..8caa70f 100644
--- a/examples/jms/management-notifications/pom.xml
+++ b/examples/jms/management-notifications/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.ManagementNotificationExample</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/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java b/examples/jms/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java
index bdbceb9..9b26ae4 100644
--- a/examples/jms/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java
+++ b/examples/jms/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java
@@ -30,20 +30,12 @@ import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* An example that shows how to receive management notifications using JMS messages.
*/
-public class ManagementNotificationExample extends ActiveMQExample
+public class ManagementNotificationExample
{
- public static void main(final String[] args)
- {
- new ManagementNotificationExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -112,8 +104,6 @@ public class ManagementNotificationExample extends ActiveMQExample
// sleep a little bit to be sure to receive the notification for the security
// authentication violation before leaving the example
Thread.sleep(2000);
-
- return true;
}
finally
{
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/management/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/management/pom.xml b/examples/jms/management/pom.xml
index 1797ce1..d287c28 100644
--- a/examples/jms/management/pom.xml
+++ b/examples/jms/management/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-jms-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -61,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>
@@ -73,8 +82,16 @@ under the License.
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.ManagementExample</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/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java b/examples/jms/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java
index 4ed1a59..fd92ddc 100644
--- a/examples/jms/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java
+++ b/examples/jms/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java
@@ -30,20 +30,13 @@ import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
/**
* An example that shows how to manage ActiveMQ Artemis using JMS messages.
*/
-public class ManagementExample extends ActiveMQExample
+public class ManagementExample
{
- public static void main(final String[] args)
- {
- new ManagementExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
QueueConnection connection = null;
InitialContext initialContext = null;
@@ -131,8 +124,6 @@ public class ManagementExample extends ActiveMQExample
// there is none to consume. The call will timeout after 5000ms and messageReceived will be null
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
System.out.println("Received message: " + messageReceived);
-
- return true;
}
finally
{
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/message-counters/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/message-counters/pom.xml b/examples/jms/message-counters/pom.xml
index f4d8753..7cd17e3 100644
--- a/examples/jms/message-counters/pom.xml
+++ b/examples/jms/message-counters/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-jms-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -67,21 +67,39 @@ under the License.
<goal>create</goal>
</goals>
<configuration>
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
- <!-- options used for JMX on the example -->
<javaOptions>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false</javaOptions>
</configuration>
</execution>
<execution>
+ <id>start</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <spawn>true</spawn>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
+ </configuration>
+ </execution>
+ <execution>
<id>runClient</id>
<goals>
<goal>runClient</goal>
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.MessageCounterExample</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/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java b/examples/jms/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
index 5f8e4e0..1e9865f 100644
--- a/examples/jms/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
+++ b/examples/jms/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
@@ -37,22 +37,15 @@ import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.core.management.MessageCounterInfo;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
/**
* An example showing how to use message counters to have information on a queue.
*/
-public class MessageCounterExample extends ActiveMQExample
+public class MessageCounterExample
{
private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3001/jmxrmi";
- public static void main(final String[] args)
- {
- new MessageCounterExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
QueueConnection connection = null;
InitialContext initialContext = null;
@@ -84,7 +77,7 @@ public class MessageCounterExample extends ActiveMQExample
// Step 7. Use JMX to retrieve the message counters using the JMSQueueControl
ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());
JMXConnector connector =
- JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, Object>());
+ JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, Object>());
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
JMSQueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc,
on,
@@ -125,8 +118,6 @@ public class MessageCounterExample extends ActiveMQExample
counters = queueControl.listMessageCounter();
messageCounter = MessageCounterInfo.fromJSON(counters);
displayMessageCounter(messageCounter);
-
- return true;
}
finally
{
@@ -142,7 +133,7 @@ public class MessageCounterExample extends ActiveMQExample
}
}
- private void displayMessageCounter(final MessageCounterInfo counter)
+ private static void displayMessageCounter(final MessageCounterInfo counter)
{
System.out.format("%s (sample updated at %s)%n", counter.getName(), counter.getUdpateTimestamp());
System.out.format(" %s message(s) added to the queue (since last sample: %s)%n",
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d0d2b4/examples/jms/message-group/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/message-group/pom.xml b/examples/jms/message-group/pom.xml
index e2e6b14..cfd67fb 100644
--- a/examples/jms/message-group/pom.xml
+++ b/examples/jms/message-group/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.MessageGroupExample</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>