msgReceived, AtomicBoolean result)
{
+ this.msgReceived = msgReceived;
+ this.result = result;
+ }
- public SimpleMessageListener()
+ public void onMessage(final Message msg)
+ {
+ TextMessage textMessage = (TextMessage)msg;
+ try
{
+ System.out.println("Received message : [" + textMessage.getText() + "]");
}
-
- public void onMessage(final Message msg)
+ catch (JMSException e)
{
- TextMessage textMessage = (TextMessage)msg;
- try
- {
- System.out.println("Received message : [" + textMessage.getText() + "]");
- }
- catch (JMSException e)
- {
- result = false;
- }
- msgReceived.add(textMessage);
+ result.set(false);
}
-
+ msgReceived.add(textMessage);
}
}
diff --git a/examples/jms/message-priority/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/message-priority/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/message-priority/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
diff --git a/examples/jms/message-priority/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/message-priority/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/message-priority/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
diff --git a/examples/jms/message-priority/src/main/resources/activemq/server0/broker.xml b/examples/jms/message-priority/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/message-priority/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/multiple-failover-failback/pom.xml b/examples/jms/multiple-failover-failback/pom.xml
index 0e429b7f6e..4ae6e9edf9 100644
--- a/examples/jms/multiple-failover-failback/pom.xml
+++ b/examples/jms/multiple-failover-failback/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,13 +57,16 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ false
+ ../data
+ true
@@ -73,7 +76,10 @@ under the License.
${basedir}/target/server1
- ${basedir}/target/classes/activemq/server1
+ true
+ true
+ ../data
+ true
@@ -83,7 +89,9 @@ under the License.
${basedir}/target/server2
- ${basedir}/target/classes/activemq/server2
+ true
+ true
+ ../data
diff --git a/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverFailbackExample.java b/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverFailbackExample.java
index 9ea1dc9642..dcfb685874 100644
--- a/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverFailbackExample.java
+++ b/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverFailbackExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
@@ -26,28 +28,9 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
-public class MultipleFailoverFailbackExample extends ActiveMQExample
+public class MultipleFailoverFailbackExample
{
public static void main(final String[] args) throws Exception
- {
- new MultipleFailoverFailbackExample().run(args);
- }
-
- protected void startServers(String[] serversArgs) throws Exception
- {
- for (int i = 0; i < serversArgs.length; i++)
- {
- startServer(i, i == 0 ? 5000 : 0);
- }
-
- Thread.sleep(5000);
- }
-
-
- @Override
- public boolean runExample() throws Exception
{
final int numMessages = 30;
@@ -55,8 +38,15 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample
InitialContext initialContext = null;
+ Process[] servers = new Process[3];
+
try
{
+ for (int i = 0; i < args.length; i++)
+ {
+ servers[i] = ServerUtil.startServer(args[i], MultipleFailoverFailbackExample.class.getSimpleName() + i, i, 5000);
+ }
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -103,9 +93,7 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample
// Step 10. Crash server #1, the live server, and wait a little while to make sure
// it has really crashed
- Thread.sleep(2000);
- killServer(0);
- Thread.sleep(5000);
+ ServerUtil.killServer(servers[0]);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -126,8 +114,7 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample
}
message0.acknowledge();
- Thread.sleep(2000);
- startServer(0, 10000);
+ servers[0] = ServerUtil.startServer(args[0], MultipleFailoverFailbackExample.class.getSimpleName() + 0, 0, 5000);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -147,8 +134,6 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample
System.out.printf("Got message: %s (redelivered?: %s)%n", message0.getText(), message0.getJMSRedelivered());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -163,6 +148,11 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample
{
initialContext.close();
}
+
+ for (int i = 0; i < args.length; i++)
+ {
+ ServerUtil.killServer(servers[i]);
+ }
}
}
}
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover-failback/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
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover-failback/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
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server0/broker.xml b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 4cf5582e6b..0000000000
--- a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ../../server0/data/messaging/bindings
-
- ../../server0/data/messaging/journal
-
- ../../server0/data/messaging/largemessages
-
- ../../server0/data/messaging/paging
-
-
-
-
-
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover-failback/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
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover-failback/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
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server1/broker.xml b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server1/broker.xml
deleted file mode 100644
index f910045c84..0000000000
--- a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server1/broker.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ../../server0/data/messaging/bindings
-
- ../../server0/data/messaging/journal
-
- ../../server0/data/messaging/largemessages
-
- ../../server0/data/messaging/paging
-
-
-
-
-
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/artemis-roles.properties b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/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
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/artemis-users.properties b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/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
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/broker.xml b/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/broker.xml
deleted file mode 100644
index 76a521a074..0000000000
--- a/examples/jms/multiple-failover-failback/src/main/resources/activemq/server2/broker.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ../../server0/data/messaging/bindings
-
- ../../server0/data/messaging/journal
-
- ../../server0/data/messaging/largemessages
-
- ../../server0/data/messaging/paging
-
-
-
-
-
-
-
-
- tcp://localhost:61618
-
-
-
-
- tcp://localhost:61618
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/multiple-failover/pom.xml b/examples/jms/multiple-failover/pom.xml
index a68679d947..cb00084618 100644
--- a/examples/jms/multiple-failover/pom.xml
+++ b/examples/jms/multiple-failover/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,13 +57,16 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ false
+ ../data
+ true
@@ -73,7 +76,10 @@ under the License.
${basedir}/target/server1
- ${basedir}/target/classes/activemq/server1
+ true
+ true
+ ../data
+ true
@@ -83,7 +89,9 @@ under the License.
${basedir}/target/server2
- ${basedir}/target/classes/activemq/server2
+ true
+ true
+ ../data
diff --git a/examples/jms/multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverExample.java b/examples/jms/multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverExample.java
index a2b55e4e7b..928e6fbf91 100644
--- a/examples/jms/multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverExample.java
+++ b/examples/jms/multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/MultipleFailoverExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
@@ -26,28 +28,9 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
-public class MultipleFailoverExample extends ActiveMQExample
+public class MultipleFailoverExample
{
public static void main(final String[] args) throws Exception
- {
- new MultipleFailoverExample().run(args);
- }
-
- protected void startServers(String[] serversArgs) throws Exception
- {
- for (int i = 0; i < serversArgs.length; i++)
- {
- startServer(i, i == 0 ? 5000 : 0);
- }
-
- Thread.sleep(5000);
- }
-
-
- @Override
- public boolean runExample() throws Exception
{
final int numMessages = 30;
@@ -55,8 +38,15 @@ public class MultipleFailoverExample extends ActiveMQExample
InitialContext initialContext = null;
+ Process[] servers = new Process[3];
+
try
{
+ for (int i = 0; i < args.length; i++)
+ {
+ servers[i] = ServerUtil.startServer(args[i], MultipleFailoverExample.class.getSimpleName() + i, i, 5000);
+ }
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -103,9 +93,7 @@ public class MultipleFailoverExample extends ActiveMQExample
// Step 10. Crash server #1, the live server, and wait a little while to make sure
// it has really crashed
- Thread.sleep(1000);
- killServer(0);
- Thread.sleep(5000);
+ ServerUtil.killServer(servers[0]);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -126,9 +114,7 @@ public class MultipleFailoverExample extends ActiveMQExample
}
message0.acknowledge();
- Thread.sleep(1000);
- killServer(getServer(connection));
- Thread.sleep(5000);
+ ServerUtil.killServer(servers[ServerUtil.getServer(connection)]);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -138,7 +124,7 @@ public class MultipleFailoverExample extends ActiveMQExample
}
catch (JMSException e)
{
- System.err.println("Got exception while acknowledging message: " + e.getMessage());
+ throw new IllegalStateException("Got exception while acknowledging message: " + e.getMessage());
}
// Step 12. Consume again the 2nd third of the messages again. Note that they are not considered as redelivered.
@@ -148,8 +134,6 @@ public class MultipleFailoverExample extends ActiveMQExample
System.out.printf("Got message: %s (redelivered?: %s)%n", message0.getText(), message0.getJMSRedelivered());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -164,6 +148,11 @@ public class MultipleFailoverExample extends ActiveMQExample
{
initialContext.close();
}
+
+ for (int i = 0; i < args.length; i++)
+ {
+ ServerUtil.killServer(servers[i]);
+ }
}
}
}
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/multiple-failover/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover/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
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/multiple-failover/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover/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
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/multiple-failover/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 323bfefa3a..0000000000
--- a/examples/jms/multiple-failover/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ../../server0/data/messaging/bindings
-
- ../../server0/data/messaging/journal
-
- ../../server0/data/messaging/largemessages
-
- ../../server0/data/messaging/paging
-
-
-
-
-
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/multiple-failover/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover/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
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/multiple-failover/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover/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
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/multiple-failover/src/main/resources/activemq/server1/broker.xml
deleted file mode 100644
index f910045c84..0000000000
--- a/examples/jms/multiple-failover/src/main/resources/activemq/server1/broker.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ../../server0/data/messaging/bindings
-
- ../../server0/data/messaging/journal
-
- ../../server0/data/messaging/largemessages
-
- ../../server0/data/messaging/paging
-
-
-
-
-
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server2/artemis-roles.properties b/examples/jms/multiple-failover/src/main/resources/activemq/server2/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover/src/main/resources/activemq/server2/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
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server2/artemis-users.properties b/examples/jms/multiple-failover/src/main/resources/activemq/server2/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/multiple-failover/src/main/resources/activemq/server2/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
diff --git a/examples/jms/multiple-failover/src/main/resources/activemq/server2/broker.xml b/examples/jms/multiple-failover/src/main/resources/activemq/server2/broker.xml
deleted file mode 100644
index c114ed20c2..0000000000
--- a/examples/jms/multiple-failover/src/main/resources/activemq/server2/broker.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ../../server0/data/messaging/bindings
-
- ../../server0/data/messaging/journal
-
- ../../server0/data/messaging/largemessages
-
- ../../server0/data/messaging/paging
-
-
-
-
-
-
-
-
-
- tcp://localhost:61618
-
-
-
-
- tcp://localhost:61618
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/no-consumer-buffering/pom.xml b/examples/jms/no-consumer-buffering/pom.xml
index 6e4818f46d..19d91783d8 100644
--- a/examples/jms/no-consumer-buffering/pom.xml
+++ b/examples/jms/no-consumer-buffering/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.NoConsumerBufferingExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
@@ -91,5 +103,4 @@ under the License.
-
diff --git a/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java b/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java
index b4bc2037fd..525a9c422c 100644
--- a/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java
+++ b/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java
@@ -25,21 +25,13 @@ 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 consumers can be configured to not buffer any messages from
* the server.
*/
-public class NoConsumerBufferingExample extends ActiveMQExample
+public class NoConsumerBufferingExample
{
- public static void main(final String[] args)
- {
- new NoConsumerBufferingExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -114,8 +106,6 @@ public class NoConsumerBufferingExample extends ActiveMQExample
System.out.println("Consumed message from consumer1: " + message.getText());
}
-
- return true;
}
finally
{
@@ -131,5 +121,4 @@ public class NoConsumerBufferingExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/no-consumer-buffering/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/no-consumer-buffering/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/no-consumer-buffering/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
diff --git a/examples/jms/no-consumer-buffering/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/no-consumer-buffering/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/no-consumer-buffering/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
diff --git a/examples/jms/no-consumer-buffering/src/main/resources/activemq/server0/broker.xml b/examples/jms/no-consumer-buffering/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/no-consumer-buffering/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/non-transaction-failover/pom.xml b/examples/jms/non-transaction-failover/pom.xml
index 675dc23c5a..72d463619b 100644
--- a/examples/jms/non-transaction-failover/pom.xml
+++ b/examples/jms/non-transaction-failover/pom.xml
@@ -27,7 +27,7 @@ under the License.
1.0.1-SNAPSHOT
- non-transaction-failover
+ artemis-jms-non-transaction-failover-example
jar
ActiveMQ Artemis JMS Non Transaction Failover Example
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,13 +57,16 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ false
+ ../data
+ true
@@ -73,7 +76,10 @@ under the License.
${basedir}/target/server1
- ${basedir}/target/classes/activemq/server1
+ true
+ true
+ ../data
+ true
@@ -93,7 +99,7 @@ under the License.
org.apache.activemq.examples.jms
- non-transaction-failover
+ artemis-jms-non-transaction-failover-example
${project.version}
diff --git a/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/NonTransactionFailoverExample.java b/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/NonTransactionFailoverExample.java
index e690fd607e..c5560722d7 100644
--- a/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/NonTransactionFailoverExample.java
+++ b/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/NonTransactionFailoverExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
@@ -26,31 +28,13 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple example that demonstrates failover of the JMS connection from one node to another
* when the live server crashes using a JMS non-transacted session.
*/
-public class NonTransactionFailoverExample extends ActiveMQExample
+public class NonTransactionFailoverExample
{
public static void main(final String[] args) throws Exception
- {
- new NonTransactionFailoverExample().run(args);
- }
-
- protected void startServers(String[] serversArgs) throws Exception
- {
- for (int i = 0; i < serversArgs.length; i++)
- {
- startServer(i, i == 0 ? 5000 : 0);
- }
-
- Thread.sleep(5000);
- }
-
- @Override
- public boolean runExample() throws Exception
{
final int numMessages = 10;
@@ -58,8 +42,15 @@ public class NonTransactionFailoverExample extends ActiveMQExample
InitialContext initialContext = null;
+ Process[] servers = new Process[2];
+
try
{
+ for (int i = 0; i < args.length; i++)
+ {
+ servers[i] = ServerUtil.startServer(args[i], NonTransactionFailoverExample.class.getSimpleName() + i, i, 5000);
+ }
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -106,9 +97,7 @@ public class NonTransactionFailoverExample extends ActiveMQExample
// Step 10. Crash server #1, the live server, and wait a little while to make sure
// pending Acks are on the server's side
- Thread.sleep(2000);
- killServer(0);
- Thread.sleep(5000);
+ ServerUtil.killServer(servers[0]);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -128,8 +117,6 @@ public class NonTransactionFailoverExample extends ActiveMQExample
System.out.printf("Got message: %s (redelivered?: %s)%n", message0.getText(), message0.getJMSRedelivered());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -144,7 +131,11 @@ public class NonTransactionFailoverExample extends ActiveMQExample
{
initialContext.close();
}
+
+ for (int i = 0; i < args.length; i++)
+ {
+ ServerUtil.killServer(servers[i]);
+ }
}
}
-
}
diff --git a/examples/jms/non-transaction-failover/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/non-transaction-failover/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/non-transaction-failover/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
diff --git a/examples/jms/non-transaction-failover/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/non-transaction-failover/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/non-transaction-failover/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
diff --git a/examples/jms/non-transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/non-transaction-failover/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 00e724b433..0000000000
--- a/examples/jms/non-transaction-failover/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
- ../../server0/data/large-messages
- ../../server0/data/bindings
- ../../server0/data/journal
- ../../server0/data/paging
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/non-transaction-failover/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
diff --git a/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/non-transaction-failover/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
diff --git a/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/broker.xml
deleted file mode 100644
index 0406b8fad9..0000000000
--- a/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/broker.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
- ../../server0/data/large-messages
- ../../server0/data/bindings
- ../../server0/data/journal
- ../../server0/data/paging
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/openwire/pom.xml b/examples/jms/openwire/pom.xml
index 1ee5cfc6e2..3888f12e5f 100644
--- a/examples/jms/openwire/pom.xml
+++ b/examples/jms/openwire/pom.xml
@@ -35,6 +35,17 @@ under the License.
${project.basedir}/../../..
+
+
+ org.apache.geronimo.specs
+ geronimo-jms_2.0_spec
+
+
+ org.apache.activemq
+ activemq-client
+
+
+
example
@@ -49,9 +60,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -61,8 +81,16 @@ under the License.
org.apache.activemq.artemis.jms.example.OpenWireExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
@@ -79,21 +107,4 @@ under the License.
-
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
-
- org.apache.geronimo.specs
- geronimo-jms_2.0_spec
-
-
- org.apache.activemq
- activemq-client
-
-
-
-
diff --git a/examples/jms/openwire/src/main/java/org/apache/activemq/artemis/jms/example/OpenWireExample.java b/examples/jms/openwire/src/main/java/org/apache/activemq/artemis/jms/example/OpenWireExample.java
index bd3b22399e..202e1b0e8a 100644
--- a/examples/jms/openwire/src/main/java/org/apache/activemq/artemis/jms/example/OpenWireExample.java
+++ b/examples/jms/openwire/src/main/java/org/apache/activemq/artemis/jms/example/OpenWireExample.java
@@ -26,24 +26,19 @@ import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;
-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 OpenWireExample extends ActiveMQExample
+public class OpenWireExample
{
public static final String OWHOST = "localhost";
public static final int OWPORT = 61616;
- public static void main(final String[] args)
- {
- new OpenWireExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
@@ -84,8 +79,6 @@ public class OpenWireExample extends ActiveMQExample
TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);
System.out.println("Received message: " + messageReceived.getText());
-
- return true;
}
finally
{
diff --git a/examples/jms/paging/pom.xml b/examples/jms/paging/pom.xml
index 83103edf98..954aad947c 100644
--- a/examples/jms/paging/pom.xml
+++ b/examples/jms/paging/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.PagingExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java b/examples/jms/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java
index d627c5a5d3..77f8eb6595 100644
--- a/examples/jms/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java
+++ b/examples/jms/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java
@@ -26,20 +26,12 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
*/
-public class PagingExample extends ActiveMQExample
+public class PagingExample
{
- public static void main(final String[] args)
- {
- new PagingExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
@@ -133,9 +125,6 @@ public class PagingExample extends ActiveMQExample
message.acknowledge();
}
-
- return true;
-
}
finally
{
@@ -153,5 +142,4 @@ public class PagingExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/perf/pom.xml b/examples/jms/perf/pom.xml
index 2db189aa17..b348a704ed 100644
--- a/examples/jms/perf/pom.xml
+++ b/examples/jms/perf/pom.xml
@@ -36,6 +36,16 @@ under the License.
+
+ org.apache.activemq
+ artemis-server
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-jms-server
+ ${project.version}
+
org.apache.activemq
artemis-core-client
@@ -55,11 +65,6 @@ under the License.
org.apache.geronimo.specs
geronimo-jms_2.0_spec
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
@@ -76,10 +81,6 @@ under the License.
create
-
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
-
runClient
@@ -88,9 +89,6 @@ under the License.
org.apache.activemq.artemis.jms.example.Server
-
- ${basedir}/target/server0
-
@@ -100,6 +98,11 @@ under the License.
artemis-jms-perf-example
${project.version}
+
+ org.apache.activemq
+ artemis-core-client
+ ${project.version}
+
diff --git a/examples/jms/pom.xml b/examples/jms/pom.xml
index 4103a8ff04..4c8db041f7 100644
--- a/examples/jms/pom.xml
+++ b/examples/jms/pom.xml
@@ -41,10 +41,9 @@ under the License.
release
- common
aerogear
- artemis-ra-rar
application-layer-failover
+ artemis-ra-rar
bridge
browser
client-kickoff
@@ -141,7 +140,6 @@ under the License.
true
- common
application-layer-failover
bridge
browser
@@ -150,11 +148,14 @@ under the License.
client-side-failoverlistener
clustered-durable-subscription
clustered-grouping
+ clustered-jgroups
clustered-queue
clustered-standalone
clustered-static-oneway
clustered-static-discovery
clustered-topic
+ colocated-failover
+ colocated-failover-scale-down
consumer-rate-limit
dead-letter
delayed-redelivery
@@ -163,10 +164,15 @@ under the License.
embedded
embedded-simple
expiry
+ ha-policy-autobackup
http-transport
interceptor
+ jms-auto-closeable
instantiate-connection-factory
jms-bridge
+ jms-completion-listener
+ jms-context
+ jms-shared-consumer
jmx
large-message
last-value-queue
@@ -180,27 +186,39 @@ under the License.
multiple-failover-failback
no-consumer-buffering
non-transaction-failover
+ openwire
paging
+ pre-acknowledge
producer-rate-limit
+ proton-cpp
+ proton-j
+ proton-ruby
queue
queue-message-redistribution
queue-requestor
queue-selector
reattach-node
+ replicated-failback
+ replicated-failback-static
replicated-multiple-failover
replicated-transaction-failover
request-reply
+ rest
+ scale-down
scheduled-message
security
send-acknowledgements
spring-integration
ssl-enabled
+ static-selector
+ static-selector-jms
stomp
stomp1.1
+ stomp1.2
symmetric-cluster
diff --git a/examples/jms/pre-acknowledge/pom.xml b/examples/jms/pre-acknowledge/pom.xml
index 030d77fc86..b181706838 100644
--- a/examples/jms/pre-acknowledge/pom.xml
+++ b/examples/jms/pre-acknowledge/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-jms-client
${project.version}
@@ -61,9 +61,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +82,16 @@ under the License.
org.apache.activemq.artemis.jms.example.PreacknowledgeExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java b/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java
index 076c98979b..446cec0468 100644
--- a/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java
+++ b/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java
@@ -32,7 +32,6 @@ import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSConstants;
import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
/**
* This example demonstrates the use of ActiveMQ Artemis "pre-acknowledge" functionality where
@@ -40,15 +39,9 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample;
*
* Please see the readme.html for more details.
*/
-public class PreacknowledgeExample extends ActiveMQExample
+public class PreacknowledgeExample
{
- public static void main(final String[] args)
- {
- new PreacknowledgeExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
@@ -98,15 +91,13 @@ public class PreacknowledgeExample extends ActiveMQExample
if (count != 0)
{
- return false;
+ throw new IllegalStateException("Queue message count is not 0.");
}
// Step 8. Finally, receive the message
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
System.out.println("Received message: " + messageReceived.getText());
-
- return true;
}
finally
{
@@ -124,7 +115,7 @@ public class PreacknowledgeExample extends ActiveMQExample
// To do this we send a management message to get the message count.
// In real life you wouldn't create a new session every time you send a management message
- private int getMessageCount(final Connection connection) throws Exception
+ private static int getMessageCount(final Connection connection) throws Exception
{
QueueSession session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
diff --git a/examples/jms/producer-rate-limit/pom.xml b/examples/jms/producer-rate-limit/pom.xml
index 535a7d562d..d407ea3a1b 100644
--- a/examples/jms/producer-rate-limit/pom.xml
+++ b/examples/jms/producer-rate-limit/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.ProducerRateLimitExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java b/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java
index 3640cdc9f4..c949122161 100644
--- a/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java
+++ b/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java
@@ -25,21 +25,13 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* This example demonstrates how a message producer can be limited to produce messages at a maximum rate
* specified in messages per sec.
*/
-public class ProducerRateLimitExample extends ActiveMQExample
+public class ProducerRateLimitExample
{
- public static void main(final String[] args)
- {
- new ProducerRateLimitExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -110,8 +102,6 @@ public class ProducerRateLimitExample extends ActiveMQExample
}
System.out.println("Received " + i + " messages");
-
- return true;
}
finally
{
@@ -126,5 +116,4 @@ public class ProducerRateLimitExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/producer-rate-limit/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/producer-rate-limit/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/producer-rate-limit/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
diff --git a/examples/jms/producer-rate-limit/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/producer-rate-limit/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/producer-rate-limit/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
diff --git a/examples/jms/producer-rate-limit/src/main/resources/activemq/server0/broker.xml b/examples/jms/producer-rate-limit/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/producer-rate-limit/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/proton-cpp/pom.xml b/examples/jms/proton-cpp/pom.xml
index c5e41a4d66..240667d032 100644
--- a/examples/jms/proton-cpp/pom.xml
+++ b/examples/jms/proton-cpp/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-jms-client
${project.version}
@@ -61,9 +61,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +82,16 @@ under the License.
org.apache.activemq.artemis.jms.example.ProtonCPPExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java b/examples/jms/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java
index b23dc55127..79c6bbc78f 100644
--- a/examples/jms/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java
+++ b/examples/jms/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java
@@ -30,7 +30,6 @@ 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;
/**
* This example demonstrates the use of ActiveMQ Artemis "pre-acknowledge" functionality where
@@ -38,15 +37,9 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample;
*
* Please see the readme.html for more details.
*/
-public class ProtonCPPExample extends ActiveMQExample
+public class ProtonCPPExample
{
- public static void main(final String[] args)
- {
- new ProtonCPPExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
@@ -95,8 +88,6 @@ public class ProtonCPPExample extends ActiveMQExample
// Sending message back to client
producerAnswer.send(session.createTextMessage("HELLO from Apache ActiveMQ Artemis"));
}
-
- return true;
}
finally
{
diff --git a/examples/jms/proton-cpp/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/proton-cpp/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/proton-cpp/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
diff --git a/examples/jms/proton-cpp/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/proton-cpp/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/proton-cpp/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
diff --git a/examples/jms/proton-cpp/src/main/resources/activemq/server0/broker.xml b/examples/jms/proton-cpp/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index eafc6c8f1d..0000000000
--- a/examples/jms/proton-cpp/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/proton-j/pom.xml b/examples/jms/proton-j/pom.xml
index 3001867f21..2cdf0c823b 100644
--- a/examples/jms/proton-j/pom.xml
+++ b/examples/jms/proton-j/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.qpid
qpid-amqp-1-0-client
@@ -62,9 +57,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -74,8 +78,16 @@ under the License.
org.apache.activemq.artemis.jms.example.ProtonJExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/proton-j/src/main/java/org/apache/activemq/artemis/jms/example/ProtonJExample.java b/examples/jms/proton-j/src/main/java/org/apache/activemq/artemis/jms/example/ProtonJExample.java
index adb3303a7a..482151d239 100644
--- a/examples/jms/proton-j/src/main/java/org/apache/activemq/artemis/jms/example/ProtonJExample.java
+++ b/examples/jms/proton-j/src/main/java/org/apache/activemq/artemis/jms/example/ProtonJExample.java
@@ -23,16 +23,10 @@ import org.apache.qpid.amqp_1_0.client.Receiver;
import org.apache.qpid.amqp_1_0.client.Sender;
import org.apache.qpid.amqp_1_0.client.Session;
import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-public class ProtonJExample extends ActiveMQExample
+public class ProtonJExample
{
- public static void main(String[] args)
- {
- new ProtonJExample().run(args);
- }
- @Override
- public boolean runExample() throws Exception
+ public static void main(String[] args) throws Exception
{
Connection connection = null;
@@ -71,7 +65,5 @@ public class ProtonJExample extends ActiveMQExample
connection.close();
}
}
-
- return true;
}
}
diff --git a/examples/jms/proton-ruby/pom.xml b/examples/jms/proton-ruby/pom.xml
index b00e3086d7..54f2269e2c 100644
--- a/examples/jms/proton-ruby/pom.xml
+++ b/examples/jms/proton-ruby/pom.xml
@@ -35,14 +35,6 @@ under the License.
${project.basedir}/../../..
-
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
-
-
example
diff --git a/examples/jms/queue-message-redistribution/pom.xml b/examples/jms/queue-message-redistribution/pom.xml
index c54657c387..8100fcc6cd 100644
--- a/examples/jms/queue-message-redistribution/pom.xml
+++ b/examples/jms/queue-message-redistribution/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -57,7 +52,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -67,7 +62,7 @@ under the License.
- create2
+ create1
create
@@ -76,6 +71,36 @@ under the License.
${basedir}/target/classes/activemq/server1
+
+ start0
+
+ cli
+
+
+ true
+ ${basedir}/target/server0
+ tcp://localhost:61616
+
+ run
+
+ server0
+
+
+
+ start1
+
+ cli
+
+
+ true
+ ${basedir}/target/server1
+ tcp://localhost:61617
+
+ run
+
+ server1
+
+
runClient
@@ -83,9 +108,29 @@ under the License.
org.apache.activemq.artemis.jms.example.QueueMessageRedistributionExample
+
+
+
+ stop0
+
+ cli
+
+
+ ${basedir}/target/server0
- ${basedir}/target/server0
- ${basedir}/target/server1
+ stop
+
+
+
+
+ stop1
+
+ cli
+
+
+ ${basedir}/target/server1
+
+ stop
diff --git a/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/artemis/jms/example/QueueMessageRedistributionExample.java b/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/artemis/jms/example/QueueMessageRedistributionExample.java
index a1d0a8f143..aec56b1a10 100644
--- a/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/artemis/jms/example/QueueMessageRedistributionExample.java
+++ b/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/artemis/jms/example/QueueMessageRedistributionExample.java
@@ -26,23 +26,15 @@ import javax.jms.TextMessage;
import javax.naming.InitialContext;
import java.util.Hashtable;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* This example demonstrates a queue with the same name deployed on two nodes of a cluster.
* Messages are initially round robin'd between both nodes of the cluster.
* The consumer on one of the nodes is then closed, and we demonstrate that the "stranded" messages
* are redistributed to the other node which has a consumer so they can be consumed.
*/
-public class QueueMessageRedistributionExample extends ActiveMQExample
+public class QueueMessageRedistributionExample
{
- public static void main(final String[] args)
- {
- new QueueMessageRedistributionExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection0 = null;
@@ -57,7 +49,7 @@ public class QueueMessageRedistributionExample extends ActiveMQExample
// Step 1. Get an initial context for looking up JNDI from server 0
Hashtable properties = new Hashtable();
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/exampleQueue", "exampleQueue");
ic0 = new InitialContext(properties);
@@ -70,7 +62,7 @@ public class QueueMessageRedistributionExample extends ActiveMQExample
// Step 4. Get an initial context for looking up JNDI from server 1
properties = new Hashtable();
properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
- properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2);
+ properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61617");
ic1 = new InitialContext(properties);
// Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
@@ -158,8 +150,6 @@ public class QueueMessageRedistributionExample extends ActiveMQExample
// Step 18. We ack the messages.
message0.acknowledge();
-
- return true;
}
finally
{
@@ -186,5 +176,4 @@ public class QueueMessageRedistributionExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml
index 2d771b0b5c..70ff4d4584 100644
--- a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml
@@ -29,14 +29,13 @@ under the License.
+ ./data/bindings
- ${data.dir}/server0/data/messaging/bindings
+ ./data/journal
- ${data.dir}/server0/data/messaging/journal
+ ./data/largemessages
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
+ ./data/paging
diff --git a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml
index 870be491db..6fc6f32d7d 100644
--- a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml
@@ -29,14 +29,13 @@ under the License.
+ ./data/bindings
- ${data.dir}/server1/data/messaging/bindings
+ ./data/journal
- ${data.dir}/server1/data/messaging/journal
+ ./data/largemessages
- ${data.dir}/server1/data/messaging/largemessages
-
- ${data.dir}/server1/data/messaging/paging
+ ./data/paging
diff --git a/examples/jms/queue-requestor/pom.xml b/examples/jms/queue-requestor/pom.xml
index 893aef7ce9..2b8e16fca2 100644
--- a/examples/jms/queue-requestor/pom.xml
+++ b/examples/jms/queue-requestor/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.QueueRequestorExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java b/examples/jms/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java
index b9ee4c7eed..b86ad9c8d7 100644
--- a/examples/jms/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java
+++ b/examples/jms/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java
@@ -26,20 +26,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 use queues requestors.
*/
-public class QueueRequestorExample extends ActiveMQExample
+public class QueueRequestorExample
{
- public static void main(final String[] args)
- {
- new QueueRequestorExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
QueueConnection connection = null;
InitialContext initialContext = null;
@@ -85,8 +77,6 @@ public class QueueRequestorExample extends ActiveMQExample
// Step 13. close the text reverser service
reverserService.close();
-
- return true;
}
finally
{
diff --git a/examples/jms/queue-selector/pom.xml b/examples/jms/queue-selector/pom.xml
index 8ccd41ced9..7f179f60a0 100644
--- a/examples/jms/queue-selector/pom.xml
+++ b/examples/jms/queue-selector/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.QueueSelectorExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java b/examples/jms/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java
index 059fe89526..4811257eb2 100644
--- a/examples/jms/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java
+++ b/examples/jms/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java
@@ -27,24 +27,16 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* A simple JMS example that uses selectors with queue consumers.
*/
-public class QueueSelectorExample extends ActiveMQExample
+public class QueueSelectorExample
{
- private volatile boolean result = true;
-
- public static void main(final String[] args)
- {
- new QueueSelectorExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ AtomicBoolean result = new AtomicBoolean(true);
Connection connection = null;
InitialContext initialContext = null;
try
@@ -65,33 +57,36 @@ public class QueueSelectorExample extends ActiveMQExample
connection.start();
// Step 5. Create a JMS Session
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session senderSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Step 6. Create a JMS Message Producer
- MessageProducer producer = session.createProducer(queue);
+ MessageProducer producer = senderSession.createProducer(queue);
// Step 8. Prepare two selectors
String redSelector = "color='red'";
String greenSelector = "color='green'";
// Step 9. Create a JMS Message Consumer that receives 'red' messages
- MessageConsumer redConsumer = session.createConsumer(queue, redSelector);
- redConsumer.setMessageListener(new SimpleMessageListener("red"));
+ Session redSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer redConsumer = redSession.createConsumer(queue, redSelector);
+ redConsumer.setMessageListener(new SimpleMessageListener("red", result));
// Step 10. Create a second JMS message consumer that receives 'green' messages
- MessageConsumer greenConsumer = session.createConsumer(queue, greenSelector);
- greenConsumer.setMessageListener(new SimpleMessageListener("green"));
+ Session greenSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer greenConsumer = greenSession.createConsumer(queue, greenSelector);
+ greenConsumer.setMessageListener(new SimpleMessageListener("green", result));
// Step 11. Create another JMS message consumer that receives any messages.
- MessageConsumer anyConsumer = session.createConsumer(queue);
- anyConsumer.setMessageListener(new SimpleMessageListener("any"));
+ Session blankSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer anyConsumer = blankSession.createConsumer(queue);
+ anyConsumer.setMessageListener(new SimpleMessageListener("any", result));
// Step 12. Create three messages, each has a color property
- TextMessage redMessage = session.createTextMessage("Red");
+ TextMessage redMessage = senderSession.createTextMessage("Red");
redMessage.setStringProperty("color", "red");
- TextMessage greenMessage = session.createTextMessage("Green");
+ TextMessage greenMessage = senderSession.createTextMessage("Green");
greenMessage.setStringProperty("color", "green");
- TextMessage blueMessage = session.createTextMessage("Blue");
+ TextMessage blueMessage = senderSession.createTextMessage("Blue");
blueMessage.setStringProperty("color", "blue");
// Step 13. Send the Messages
@@ -104,7 +99,8 @@ public class QueueSelectorExample extends ActiveMQExample
Thread.sleep(5000);
- return result;
+ if (!result.get())
+ throw new IllegalStateException();
}
finally
{
@@ -119,40 +115,39 @@ public class QueueSelectorExample extends ActiveMQExample
}
}
}
+}
- public class SimpleMessageListener implements MessageListener
+class SimpleMessageListener implements MessageListener
+{
+ private final String name;
+ private AtomicBoolean result;
+
+ public SimpleMessageListener(final String listener, AtomicBoolean result)
{
-
- private final String name;
-
- public SimpleMessageListener(final String listener)
- {
- name = listener;
- }
-
- public void onMessage(final Message msg)
- {
- TextMessage textMessage = (TextMessage)msg;
- try
- {
- String colorProp = msg.getStringProperty("color");
- System.out.println("Receiver " + name +
- " receives message [" +
- textMessage.getText() +
- "] with color property: " +
- colorProp);
- if (!colorProp.equals(name) && !name.equals("any"))
- {
- result = false;
- }
- }
- catch (JMSException e)
- {
- e.printStackTrace();
- result = false;
- }
- }
-
+ name = listener;
+ this.result = result;
}
+ public void onMessage(final Message msg)
+ {
+ TextMessage textMessage = (TextMessage)msg;
+ try
+ {
+ String colorProp = msg.getStringProperty("color");
+ System.out.println("Receiver " + name +
+ " receives message [" +
+ textMessage.getText() +
+ "] with color property: " +
+ colorProp);
+ if (!colorProp.equals(name) && !name.equals("any"))
+ {
+ result.set(false);
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ result.set(false);
+ }
+ }
}
diff --git a/examples/jms/queue-selector/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/queue-selector/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/queue-selector/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
diff --git a/examples/jms/queue-selector/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/queue-selector/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/queue-selector/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
diff --git a/examples/jms/queue-selector/src/main/resources/activemq/server0/broker.xml b/examples/jms/queue-selector/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 78f96f3899..0000000000
--- a/examples/jms/queue-selector/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/queue/pom.xml b/examples/jms/queue/pom.xml
index 9619a7f044..fecaaf78ba 100644
--- a/examples/jms/queue/pom.xml
+++ b/examples/jms/queue/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
-
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.QueueExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java b/examples/jms/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java
index af9b728673..5cbf0cd8ac 100644
--- a/examples/jms/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java
+++ b/examples/jms/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.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 creates a producer and consumer on a queue and sends then receives a message.
*/
-public class QueueExample extends ActiveMQExample
+public class QueueExample
{
- public static void main(final String[] args)
- {
- new QueueExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -80,8 +72,6 @@ public class QueueExample extends ActiveMQExample
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
System.out.println("Received message: " + messageReceived.getText());
-
- return true;
}
finally
{
diff --git a/examples/jms/reattach-node/pom.xml b/examples/jms/reattach-node/pom.xml
index 76ae5d7eb3..885adcf528 100644
--- a/examples/jms/reattach-node/pom.xml
+++ b/examples/jms/reattach-node/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-jms-client
${project.version}
@@ -66,6 +66,19 @@ under the License.
${basedir}/target/classes/activemq/server0
+
+ start
+
+ cli
+
+
+ true
+ tcp://localhost:61616
+
+ run
+
+
+
runClient
@@ -73,8 +86,16 @@ under the License.
org.apache.activemq.artemis.jms.example.ReattachExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java b/examples/jms/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java
index 34393d0a40..2b05090b36 100644
--- a/examples/jms/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java
+++ b/examples/jms/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java
@@ -30,22 +30,15 @@ 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;
/**
* This examples demonstrates a connection created to a server. Failure of the network connection is then simulated
*
* The network is brought back up and the client reconnects and resumes transparently.
*/
-public class ReattachExample extends ActiveMQExample
+public class ReattachExample
{
- public static void main(final String[] args)
- {
- new ReattachExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -103,8 +96,6 @@ public class ReattachExample extends ActiveMQExample
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
System.out.println("Received message: " + messageReceived.getText());
-
- return true;
}
finally
{
@@ -121,12 +112,12 @@ public class ReattachExample extends ActiveMQExample
}
}
- private void stopAcceptor() throws Exception
+ private static void stopAcceptor() throws Exception
{
stopStartAcceptor(true);
}
- private void startAcceptor() throws Exception
+ private static void startAcceptor() throws Exception
{
stopStartAcceptor(false);
}
@@ -134,7 +125,7 @@ public class ReattachExample extends ActiveMQExample
// To do this we send a management message to close the acceptor, we do this on a different
// connection factory which uses a different remoting connection so we can still send messages
// when the main connection has been stopped
- private void stopStartAcceptor(final boolean stop) throws Exception
+ private static void stopStartAcceptor(final boolean stop) throws Exception
{
Hashtable properties = new Hashtable();
properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
diff --git a/examples/jms/reattach-node/src/main/resources/activemq/server0/broker.xml b/examples/jms/reattach-node/src/main/resources/activemq/server0/broker.xml
index 0edc66a327..20321a2ba7 100644
--- a/examples/jms/reattach-node/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/reattach-node/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/replicated-failback-static/pom.xml b/examples/jms/replicated-failback-static/pom.xml
index 9a9a2f73f5..2cd507255d 100644
--- a/examples/jms/replicated-failback-static/pom.xml
+++ b/examples/jms/replicated-failback-static/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,7 +57,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -68,7 +68,7 @@ under the License.
- create2
+ create1
create
@@ -104,5 +104,4 @@ under the License.
-
diff --git a/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticExample.java b/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticExample.java
index 7618c402ed..2f22cb9fcd 100644
--- a/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticExample.java
+++ b/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
@@ -26,8 +28,6 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* Example of live and replicating backup pair.
*
@@ -35,15 +35,13 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample;
*
* Later the live server is restarted and takes back its position by asking the backup to stop ("fail-back").
*/
-public class ReplicatedFailbackStaticExample extends ActiveMQExample
+public class ReplicatedFailbackStaticExample
{
- public static void main(final String[] args)
- {
- new ReplicatedFailbackStaticExample().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
{
final int numMessages = 30;
@@ -53,6 +51,9 @@ public class ReplicatedFailbackStaticExample extends ActiveMQExample
try
{
+ server0 = ServerUtil.startServer(args[0], ReplicatedFailbackStaticExample.class.getSimpleName() + "0", 0, 30000);
+ server1 = ServerUtil.startServer(args[1], ReplicatedFailbackStaticExample.class.getSimpleName() + "1", 1, 10000);
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -97,10 +98,9 @@ public class ReplicatedFailbackStaticExample extends ActiveMQExample
System.out.println("Got message: " + message0.getText());
}
- // Step 10. Crash server #1, the live server, and wait a little while to make sure
+ // Step 10. Crash server #0, the live server, and wait a little while to make sure
// it has really crashed
- Thread.sleep(5000);
- killServer(0);
+ ServerUtil.killServer(server0);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -121,9 +121,7 @@ public class ReplicatedFailbackStaticExample extends ActiveMQExample
}
message0.acknowledge();
- reStartServer(0, 10000);
-
- Thread.sleep(10000);
+ server0 = ServerUtil.startServer(args[0], ReplicatedFailbackStaticExample.class.getSimpleName() + "0", 0, 10000);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -143,8 +141,6 @@ public class ReplicatedFailbackStaticExample extends ActiveMQExample
System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -159,7 +155,9 @@ public class ReplicatedFailbackStaticExample extends ActiveMQExample
{
initialContext.close();
}
+
+ ServerUtil.killServer(server0);
+ ServerUtil.killServer(server1);
}
}
-
}
diff --git a/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback-static/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
diff --git a/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback-static/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
diff --git a/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/broker.xml b/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/broker.xml
index 2bb35527e2..f59bdbcd82 100644
--- a/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/replicated-failback-static/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
exampleUser
diff --git a/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback-static/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
diff --git a/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback-static/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
diff --git a/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml
index 71e2e4e774..9173c64a41 100644
--- a/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/replicated-failback-static/src/main/resources/activemq/server1/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server1/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server1/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server1/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server1/data/messaging/paging
+ ${data.dir:./data}/paging
exampleUser
diff --git a/examples/jms/replicated-failback/pom.xml b/examples/jms/replicated-failback/pom.xml
index 7a27d383bb..d9c5150a8b 100644
--- a/examples/jms/replicated-failback/pom.xml
+++ b/examples/jms/replicated-failback/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,7 +57,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -68,7 +68,7 @@ under the License.
- create2
+ create1
create
@@ -104,5 +104,4 @@ under the License.
-
diff --git a/examples/jms/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java b/examples/jms/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java
index 02fcbaf288..1cd933addc 100644
--- a/examples/jms/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java
+++ b/examples/jms/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
@@ -26,8 +28,6 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* Example of live and replicating backup pair.
*
@@ -35,21 +35,13 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample;
*
* Later the live server is restarted and takes back its position by asking the backup to stop ("fail-back").
*/
-public class ReplicatedFailbackExample extends ActiveMQExample
+public class ReplicatedFailbackExample
{
- public static void main(final String[] args)
- {
- new ReplicatedFailbackExample().run(args);
- }
+ private static Process server0;
- protected void startServers(String[] serversArgs) throws Exception
- {
- startServer(0, 60000);
- startServer(1, 10000);
- }
+ private static Process server1;
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
final int numMessages = 30;
@@ -59,6 +51,9 @@ public class ReplicatedFailbackExample extends ActiveMQExample
try
{
+ server0 = ServerUtil.startServer(args[0], ReplicatedFailbackExample.class.getSimpleName() + "0", 0, 30000);
+ server1 = ServerUtil.startServer(args[1], ReplicatedFailbackExample.class.getSimpleName() + "1", 1, 10000);
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -103,10 +98,9 @@ public class ReplicatedFailbackExample extends ActiveMQExample
System.out.println("Got message: " + message0.getText());
}
- // Step 10. Crash server #1, the live server, and wait a little while to make sure
+ // Step 10. Crash server #0, the live server, and wait a little while to make sure
// it has really crashed
- Thread.sleep(5000);
- killServer(0);
+ ServerUtil.killServer(server0);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -127,9 +121,7 @@ public class ReplicatedFailbackExample extends ActiveMQExample
}
message0.acknowledge();
- reStartServer(0, 10000);
-
- Thread.sleep(10000);
+ server0 = ServerUtil.startServer(args[0], ReplicatedFailbackExample.class.getSimpleName() + "0", 0, 10000);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -149,8 +141,6 @@ public class ReplicatedFailbackExample extends ActiveMQExample
System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -165,7 +155,9 @@ public class ReplicatedFailbackExample extends ActiveMQExample
{
initialContext.close();
}
+
+ ServerUtil.killServer(server0);
+ ServerUtil.killServer(server1);
}
}
-
}
diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/replicated-failback/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback/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
diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/replicated-failback/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback/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
diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml b/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml
index e762e2c92c..ab85a389cd 100644
--- a/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/replicated-failback/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/live/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/live/journal
+ ${data.dir:./data}/journal
- ${data.dir}/live/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/live/paging
+ ${data.dir:./data}/paging
exampleUser
diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/replicated-failback/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback/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
diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/replicated-failback/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-failback/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
diff --git a/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml
index af242b9d12..cfb7e3322f 100644
--- a/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/replicated-failback/src/main/resources/activemq/server1/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/bkp/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/bkp/journal
+ ${data.dir:./data}/journal
- ${data.dir}/bkp/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/bkp/paging
+ ${data.dir:./data}/paging
exampleUser
diff --git a/examples/jms/replicated-multiple-failover/pom.xml b/examples/jms/replicated-multiple-failover/pom.xml
index 60ba4a6532..d1af812756 100644
--- a/examples/jms/replicated-multiple-failover/pom.xml
+++ b/examples/jms/replicated-multiple-failover/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,7 +57,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -68,7 +68,7 @@ under the License.
- create2
+ create1
create
@@ -78,6 +78,17 @@ under the License.
-Dudp-address=${udp-address}
+
+ create2
+
+ create
+
+
+ ${basedir}/target/server2
+ ${basedir}/target/classes/activemq/server2
+ -Dudp-address=${udp-address}
+
+
runClient
@@ -88,6 +99,7 @@ under the License.
${basedir}/target/server0
${basedir}/target/server1
+ ${basedir}/target/server2
diff --git a/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java b/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java
index 388506545a..31dc492eb8 100644
--- a/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java
+++ b/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
@@ -26,17 +28,15 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
-public class ReplicatedMultipleFailoverExample extends ActiveMQExample
+public class ReplicatedMultipleFailoverExample
{
- public static void main(final String[] args)
- {
- new ReplicatedMultipleFailoverExample().run(args);
- }
+ private static Process server0;
- @Override
- public boolean runExample() throws Exception
+ private static Process server1;
+
+ private static Process server2;
+
+ public static void main(final String[] args) throws Exception
{
final int numMessages = 30;
@@ -46,6 +46,12 @@ public class ReplicatedMultipleFailoverExample extends ActiveMQExample
try
{
+ server0 = ServerUtil.startServer(args[0], ReplicatedMultipleFailoverExample.class.getSimpleName() + "0", 0, 5000);
+ server1 = ServerUtil.startServer(args[1], ReplicatedMultipleFailoverExample.class.getSimpleName() + "1", 1, 5000);
+ server2 = ServerUtil.startServer(args[2], ReplicatedMultipleFailoverExample.class.getSimpleName() + "2", 2, 5000);
+
+ Process[] processes = new Process[] {server0, server1, server2};
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -90,10 +96,10 @@ public class ReplicatedMultipleFailoverExample extends ActiveMQExample
System.out.println("Got message: " + message0.getText());
}
- // Step 10. Crash server #1, the live server, and wait a little while to make sure
+ // Step 10. Crash server #0, the live server, and wait a little while to make sure
// it has really crashed
+ ServerUtil.killServer(server0);
Thread.sleep(5000);
- killServer(0);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -114,8 +120,7 @@ public class ReplicatedMultipleFailoverExample extends ActiveMQExample
}
message0.acknowledge();
- Thread.sleep(5000);
- killServer(getServer(connection));
+ ServerUtil.killServer(processes[ServerUtil.getServer(connection)]);
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
// backup server has occurred
@@ -135,8 +140,6 @@ public class ReplicatedMultipleFailoverExample extends ActiveMQExample
System.out.printf("Got message: %s (redelivered?: %s)%n", message0.getText(), message0.getJMSRedelivered());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -151,7 +154,10 @@ public class ReplicatedMultipleFailoverExample extends ActiveMQExample
{
initialContext.close();
}
+
+ ServerUtil.killServer(server0);
+ ServerUtil.killServer(server1);
+ ServerUtil.killServer(server2);
}
}
-
}
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-multiple-failover/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
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-multiple-failover/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
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml
index eb47eb2b34..fb321c22fc 100644
--- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-multiple-failover/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
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-multiple-failover/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
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml
index 344bfbfd07..1cb959ce8f 100644
--- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server1/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server1/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server1/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server1/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/artemis-roles.properties b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/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
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/artemis-users.properties b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/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
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml
index 804f63f641..fbbd45f9dd 100644
--- a/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml
+++ b/examples/jms/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server2/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server2/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server2/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server2/data/messaging/paging
+ ${data.dir:./data}/paging
@@ -43,6 +43,7 @@ under the License.
+
tcp://localhost:61618
diff --git a/examples/jms/replicated-transaction-failover/pom.xml b/examples/jms/replicated-transaction-failover/pom.xml
index b6def6610e..2c10c66ce0 100644
--- a/examples/jms/replicated-transaction-failover/pom.xml
+++ b/examples/jms/replicated-transaction-failover/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,7 +57,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -68,7 +68,7 @@ under the License.
- create2
+ create1
create
@@ -104,5 +104,4 @@ under the License.
-
diff --git a/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java b/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java
index f202e2ea1c..dcc89d2e57 100644
--- a/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java
+++ b/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java
@@ -16,6 +16,9 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -26,29 +29,23 @@ import javax.jms.TextMessage;
import javax.jms.TransactionRolledBackException;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.api.core.Message;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple example that demonstrates failover of the JMS connection from one node to another
* when the live server crashes using a JMS transacted session and replication.
*/
-public class ReplicatedTransactionFailoverExample extends ActiveMQExample
+public class ReplicatedTransactionFailoverExample
{
+ private static Process server0;
+
+ private static Process server1;
// You need to guarantee uniqueIDs when using duplicate detection
// It needs to be unique even after a restart
// as these IDs are stored on the journal for control
// We recommend some sort of UUID, but for this example the Current Time as string would be enough
- String uniqueID = Long.toString(System.currentTimeMillis());
+ private static String uniqueID = Long.toString(System.currentTimeMillis());
- public static void main(final String[] args)
- {
- new ReplicatedTransactionFailoverExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
final int numMessages = 10;
@@ -58,6 +55,9 @@ public class ReplicatedTransactionFailoverExample extends ActiveMQExample
try
{
+ server0 = ServerUtil.startServer(args[0], ReplicatedTransactionFailoverExample.class.getSimpleName() + "0", 0, 5000);
+ server1 = ServerUtil.startServer(args[1], ReplicatedTransactionFailoverExample.class.getSimpleName() + "1", 1, 5000);
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -108,9 +108,7 @@ public class ReplicatedTransactionFailoverExample extends ActiveMQExample
if (message0 == null)
{
- System.err.println("Example failed - message wasn't received");
-
- return false;
+ throw new IllegalStateException("Example failed - message wasn't received");
}
System.out.println("Got message: " + message0.getText());
@@ -119,8 +117,6 @@ public class ReplicatedTransactionFailoverExample extends ActiveMQExample
session.commit();
System.out.println("Other message on the server? " + consumer.receive(5000));
-
- return true;
}
finally
{
@@ -135,10 +131,13 @@ public class ReplicatedTransactionFailoverExample extends ActiveMQExample
{
initialContext.close();
}
+
+ ServerUtil.killServer(server0);
+ ServerUtil.killServer(server1);
}
}
- private void sendMessages(final Session session,
+ private static void sendMessages(final Session session,
final MessageProducer producer,
final int numMessages,
final boolean killServer) throws Exception
@@ -160,10 +159,7 @@ public class ReplicatedTransactionFailoverExample extends ActiveMQExample
if (killServer)
{
- Thread.sleep(5000);
-
- killServer(0);
-
+ ServerUtil.killServer(server0);
}
// We send the remaining half of messages
diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-transaction-failover/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
diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-transaction-failover/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
diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml
index 597f828773..9233f17aa5 100644
--- a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-transaction-failover/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
diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/replicated-transaction-failover/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
diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml
index cdefc88f11..848525ee20 100644
--- a/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server1/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server1/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server1/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server1/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/request-reply/pom.xml b/examples/jms/request-reply/pom.xml
index 5880d9d8fc..e8849d81fd 100644
--- a/examples/jms/request-reply/pom.xml
+++ b/examples/jms/request-reply/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.RequestReplyExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
@@ -91,5 +103,4 @@ under the License.
-
diff --git a/examples/jms/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java b/examples/jms/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java
index 751f2da972..7e9093fa09 100644
--- a/examples/jms/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java
+++ b/examples/jms/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java
@@ -33,8 +33,6 @@ import javax.jms.TemporaryQueue;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS example that shows how to use Request/Replay style messaging.
*
@@ -43,18 +41,11 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample;
*
* Or better still use the correlation id, and just store the requests in a map, then you don't need a temporary queue at all
*/
-public class RequestReplyExample extends ActiveMQExample
+public class RequestReplyExample
{
- private final Map requestMap = new HashMap();
-
- public static void main(final String[] args)
- {
- new RequestReplyExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ final Map requestMap = new HashMap();
Connection connection = null;
InitialContext initialContext = null;
@@ -129,8 +120,6 @@ public class RequestReplyExample extends ActiveMQExample
// Step 19. Shutdown the request server
server.shutdown();
-
- return true;
}
finally
{
@@ -146,79 +135,78 @@ public class RequestReplyExample extends ActiveMQExample
}
}
}
+}
- private class SimpleRequestServer implements MessageListener
+class SimpleRequestServer implements MessageListener
+{
+ private Connection connection;
+
+ private Session session;
+
+ MessageProducer replyProducer;
+
+ MessageConsumer requestConsumer;
+
+ public void start() throws Exception
{
- private Connection connection;
+ // Get an initial context to perform the JNDI lookup.
+ InitialContext initialContext = new InitialContext();
- private Session session;
+ // Lookup the queue to receive the request message
+ Queue requestQueue = (Queue)initialContext.lookup("queue/exampleQueue");
- MessageProducer replyProducer;
+ // Lookup for the Connection Factory
+ ConnectionFactory cfact = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
- MessageConsumer requestConsumer;
+ // Create a connection
+ connection = cfact.createConnection();
- public void start() throws Exception
+ // Start the connection;
+ connection.start();
+
+ // Create a session
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Create a producer to send the reply message
+ replyProducer = session.createProducer(null);
+
+ // Create the request comsumer
+ requestConsumer = session.createConsumer(requestQueue);
+
+ // register the listener
+ requestConsumer.setMessageListener(this);
+ }
+
+ public void onMessage(final Message request)
+ {
+ try
{
- // Get an initial context to perform the JNDI lookup.
- InitialContext initialContext = new InitialContext();
+ System.out.println("Received request message: " + ((TextMessage)request).getText());
- // Lookup the queue to receive the request message
- Queue requestQueue = (Queue)initialContext.lookup("queue/exampleQueue");
+ // Extract the ReplyTo destination
+ Destination replyDestination = request.getJMSReplyTo();
- // Lookup for the Connection Factory
- ConnectionFactory cfact = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
+ System.out.println("Reply to queue: " + replyDestination);
- // Create a connection
- connection = cfact.createConnection();
+ // Create the reply message
+ TextMessage replyMessage = session.createTextMessage("A reply message");
- // Start the connection;
- connection.start();
+ // Set the CorrelationID, using message id.
+ replyMessage.setJMSCorrelationID(request.getJMSMessageID());
- // Create a session
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ // Send out the reply message
+ replyProducer.send(replyDestination, replyMessage);
- // Create a producer to send the reply message
- replyProducer = session.createProducer(null);
-
- // Create the request comsumer
- requestConsumer = session.createConsumer(requestQueue);
-
- // register the listener
- requestConsumer.setMessageListener(this);
+ System.out.println("Reply sent");
}
-
- public void onMessage(final Message request)
+ catch (JMSException e)
{
- try
- {
- System.out.println("Received request message: " + ((TextMessage)request).getText());
-
- // Extract the ReplyTo destination
- Destination replyDestination = request.getJMSReplyTo();
-
- System.out.println("Reply to queue: " + replyDestination);
-
- // Create the reply message
- TextMessage replyMessage = session.createTextMessage("A reply message");
-
- // Set the CorrelationID, using message id.
- replyMessage.setJMSCorrelationID(request.getJMSMessageID());
-
- // Send out the reply message
- replyProducer.send(replyDestination, replyMessage);
-
- System.out.println("Reply sent");
- }
- catch (JMSException e)
- {
- e.printStackTrace();
- }
- }
-
- public void shutdown() throws JMSException
- {
- connection.close();
+ e.printStackTrace();
}
}
+ public void shutdown() throws JMSException
+ {
+ connection.close();
+ }
}
diff --git a/examples/jms/scale-down/pom.xml b/examples/jms/scale-down/pom.xml
index 5a1cd36585..596273b970 100644
--- a/examples/jms/scale-down/pom.xml
+++ b/examples/jms/scale-down/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,7 +57,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -68,7 +68,7 @@ under the License.
- create2
+ create1
create
diff --git a/examples/jms/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java b/examples/jms/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java
index f3704911de..73adf3320a 100644
--- a/examples/jms/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java
+++ b/examples/jms/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -26,21 +28,17 @@ import javax.jms.TextMessage;
import javax.naming.InitialContext;
import java.util.Hashtable;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple example that demonstrates a colocated server
*
*/
-public class ScaleDownExample extends ActiveMQExample
+public class ScaleDownExample
{
- public static void main(final String[] args)
- {
- new ScaleDownExample().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
{
final int numMessages = 30;
@@ -52,16 +50,19 @@ public class ScaleDownExample extends ActiveMQExample
try
{
+ server0 = ServerUtil.startServer(args[0], ScaleDownExample.class.getSimpleName() + "0", 0, 5000);
+ server1 = ServerUtil.startServer(args[1], ScaleDownExample.class.getSimpleName() + "1", 1, 5000);
+
// Step 1. Get an initial context for looking up JNDI for both servers
Hashtable properties = new Hashtable();
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");
initialContext = new InitialContext(properties);
properties = new Hashtable();
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");
initialContext1 = new InitialContext(properties);
// Step 2. Look up the JMS resources from JNDI
@@ -92,12 +93,8 @@ public class ScaleDownExample extends ActiveMQExample
System.out.println("Sent message: " + message.getText());
}
- // Step 7. Crash server #1, the live server, and wait a little while to make sure
- // it has really crashed
- Thread.sleep(5000);
- killServer(1);
- Thread.sleep(5000);
-
+ // Step 7. Crash server #1
+ ServerUtil.killServer(server1);
// Step 8. start the connection ready to receive messages
connection.start();
@@ -114,8 +111,6 @@ public class ScaleDownExample extends ActiveMQExample
System.out.println("Got message: " + message0.getText());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -139,7 +134,9 @@ public class ScaleDownExample extends ActiveMQExample
{
initialContext1.close();
}
+
+ ServerUtil.killServer(server0);
+ ServerUtil.killServer(server1);
}
}
-
}
diff --git a/examples/jms/scale-down/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/scale-down/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/scale-down/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
diff --git a/examples/jms/scale-down/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/scale-down/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/scale-down/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
diff --git a/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml b/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml
index b2e18876fc..1a08c9dd33 100644
--- a/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml
@@ -29,14 +29,13 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir:../data}/bindings
+ ${data.dir:./data}/journal
- ${data.dir:../data}/journal
+ ${data.dir:./data}/largemessages
- ${data.dir:../data}/largemessages
-
- ${data.dir:../data}/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/scale-down/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/scale-down/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/scale-down/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
diff --git a/examples/jms/scale-down/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/scale-down/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/scale-down/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
diff --git a/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml b/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml
index e198399b0e..87dd4aab0e 100644
--- a/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml
@@ -29,14 +29,13 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir:../data}/bindings
+ ${data.dir:./data}/journal
- ${data.dir:../data}/journal
+ ${data.dir:./data}/largemessages
- ${data.dir:../data}/largemessages
-
- ${data.dir:../data}/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/scheduled-message/pom.xml b/examples/jms/scheduled-message/pom.xml
index 676e5573f0..cfda2ac233 100644
--- a/examples/jms/scheduled-message/pom.xml
+++ b/examples/jms/scheduled-message/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-core-client
${project.version}
@@ -61,9 +61,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +82,16 @@ under the License.
org.apache.activemq.artemis.jms.example.ScheduledMessageExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java b/examples/jms/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java
index 2fa38bfd2f..ffc99d84ef 100644
--- a/examples/jms/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java
+++ b/examples/jms/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java
@@ -29,17 +29,10 @@ import javax.jms.TextMessage;
import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.core.Message;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-public class ScheduledMessageExample extends ActiveMQExample
+public class ScheduledMessageExample
{
- public static void main(final String[] args)
- {
- new ScheduledMessageExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -89,8 +82,6 @@ public class ScheduledMessageExample extends ActiveMQExample
System.out.println("Received message: " + messageReceived.getText());
System.out.println("Time of receive: " + formatter.format(new Date()));
-
- return true;
}
finally
{
@@ -105,5 +96,4 @@ public class ScheduledMessageExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/scheduled-message/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/scheduled-message/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/scheduled-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
diff --git a/examples/jms/scheduled-message/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/scheduled-message/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/scheduled-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
diff --git a/examples/jms/scheduled-message/src/main/resources/activemq/server0/broker.xml b/examples/jms/scheduled-message/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/scheduled-message/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/security/pom.xml b/examples/jms/security/pom.xml
index 88330b12a0..a58e17701c 100644
--- a/examples/jms/security/pom.xml
+++ b/examples/jms/security/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,20 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+ bill
+ activemq
+
+ run
+
@@ -73,8 +79,16 @@ under the License.
org.apache.activemq.artemis.jms.example.SecurityExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java b/examples/jms/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
index eb7ffc0a28..fc83fe7ebd 100644
--- a/examples/jms/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
+++ b/examples/jms/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
@@ -27,20 +27,13 @@ import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
-public class SecurityExample extends ActiveMQExample
+public class SecurityExample
{
- private boolean result = true;
- public static void main(final String[] args)
- {
- new SecurityExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ boolean result = true;
+ Connection failConnection = null;
Connection billConnection = null;
Connection andrewConnection = null;
Connection frankConnection = null;
@@ -63,7 +56,7 @@ public class SecurityExample extends ActiveMQExample
// Step 4. Try to create a JMS Connection without user/password. It will fail.
try
{
- cf.createConnection();
+ failConnection = cf.createConnection();
result = false;
}
catch (JMSSecurityException e)
@@ -136,12 +129,14 @@ public class SecurityExample extends ActiveMQExample
// Step 18. Check permissions on news.us.usTopic for sam: can't send but can receive
checkUserReceiveNoSend(usTopic, samConnection, "sam", frankConnection);
System.out.println("-------------------------------------------------------------------------------------");
-
- return result;
}
finally
{
// Step 19. Be sure to close our JMS resources!
+ if (failConnection != null)
+ {
+ failConnection.close();
+ }
if (billConnection != null)
{
billConnection.close();
@@ -168,7 +163,7 @@ public class SecurityExample extends ActiveMQExample
}
// Check the user can receive message but cannot send message.
- private void checkUserReceiveNoSend(final Topic topic,
+ private static void checkUserReceiveNoSend(final Topic topic,
final Connection connection,
final String user,
final Connection sendingConn) throws JMSException
@@ -181,12 +176,11 @@ public class SecurityExample extends ActiveMQExample
try
{
producer.send(msg);
- System.out.println("Security setting is broken! User " + user +
+ throw new IllegalStateException("Security setting is broken! User " + user +
" can send message [" +
msg.getText() +
"] to topic " +
topic);
- result = false;
}
catch (JMSException e)
{
@@ -206,8 +200,7 @@ public class SecurityExample extends ActiveMQExample
}
else
{
- System.out.println("Security setting is broken! User " + user + " cannot receive message from topic " + topic);
- result = false;
+ throw new IllegalStateException("Security setting is broken! User " + user + " cannot receive message from topic " + topic);
}
session1.close();
@@ -215,7 +208,7 @@ public class SecurityExample extends ActiveMQExample
}
// Check the user can send message but cannot receive message
- private void checkUserSendNoReceive(final Topic topic,
+ private static void checkUserSendNoReceive(final Topic topic,
final Connection connection,
final String user,
final Connection receivingConn) throws JMSException
@@ -244,12 +237,11 @@ public class SecurityExample extends ActiveMQExample
}
else
{
- System.out.println("Security setting is broken! User " + user +
+ throw new IllegalStateException("Security setting is broken! User " + user +
" cannot send message [" +
msg.getText() +
"] to topic " +
topic);
- result = false;
}
session.close();
@@ -257,7 +249,7 @@ public class SecurityExample extends ActiveMQExample
}
// Check the user has neither send nor receive permission on topic
- private void checkUserNoSendNoReceive(final Topic topic, final Connection connection, final String user) throws JMSException
+ private static void checkUserNoSendNoReceive(final Topic topic, final Connection connection, final String user) throws JMSException
{
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(topic);
@@ -275,12 +267,11 @@ public class SecurityExample extends ActiveMQExample
try
{
producer.send(msg);
- System.out.println("Security setting is broken! User " + user +
+ throw new IllegalStateException("Security setting is broken! User " + user +
" can send message [" +
msg.getText() +
"] to topic " +
topic);
- result = false;
}
catch (JMSException e)
{
@@ -291,7 +282,7 @@ public class SecurityExample extends ActiveMQExample
}
// Check the user connection has both send and receive permissions on the topic
- private void checkUserSendAndReceive(final Topic topic, final Connection connection, final String user) throws JMSException
+ private static void checkUserSendAndReceive(final Topic topic, final Connection connection, final String user) throws JMSException
{
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
TextMessage msg = session.createTextMessage("hello-world-4");
@@ -306,13 +297,12 @@ public class SecurityExample extends ActiveMQExample
}
else
{
- System.out.println("Error! User " + user + " cannot receive the message! ");
- result = false;
+ throw new IllegalStateException("Error! User " + user + " cannot receive the message! ");
}
session.close();
}
- private Connection createConnection(final String username, final String password, final ConnectionFactory cf) throws JMSException
+ private static Connection createConnection(final String username, final String password, final ConnectionFactory cf) throws JMSException
{
return cf.createConnection(username, password);
}
diff --git a/examples/jms/send-acknowledgements/pom.xml b/examples/jms/send-acknowledgements/pom.xml
index 7aa59cf24a..6d22b092ce 100644
--- a/examples/jms/send-acknowledgements/pom.xml
+++ b/examples/jms/send-acknowledgements/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-jms-client
${project.version}
@@ -61,9 +61,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +82,16 @@ under the License.
org.apache.activemq.artemis.jms.example.SendAcknowledgementsExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java b/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java
index 03fb866a1b..99fb0bae21 100644
--- a/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java
+++ b/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java
@@ -27,7 +27,6 @@ import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
import org.apache.activemq.artemis.jms.client.ActiveMQSession;
/**
@@ -37,15 +36,9 @@ import org.apache.activemq.artemis.jms.client.ActiveMQSession;
* to the stream of messages being sent to the server.
* For more information please see the readme.html file
*/
-public class SendAcknowledgementsExample extends ActiveMQExample
+public class SendAcknowledgementsExample
{
- public static void main(final String[] args)
- {
- new SendAcknowledgementsExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -101,8 +94,6 @@ public class SendAcknowledgementsExample extends ActiveMQExample
System.out.println("Sent message " + i);
}
-
- return true;
}
finally
{
@@ -118,5 +109,4 @@ public class SendAcknowledgementsExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/send-acknowledgements/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/send-acknowledgements/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/send-acknowledgements/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
diff --git a/examples/jms/send-acknowledgements/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/send-acknowledgements/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/send-acknowledgements/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
diff --git a/examples/jms/send-acknowledgements/src/main/resources/activemq/server0/broker.xml b/examples/jms/send-acknowledgements/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/send-acknowledgements/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/spring-integration/pom.xml b/examples/jms/spring-integration/pom.xml
index 25ae488804..fcc6d9f6f3 100644
--- a/examples/jms/spring-integration/pom.xml
+++ b/examples/jms/spring-integration/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.activemq
artemis-spring-integration
@@ -72,9 +67,6 @@ under the License.
org.apache.activemq.artemis.jms.example.SpringExample
-
- ${basedir}/target/server0
-
diff --git a/examples/jms/ssl-enabled/pom.xml b/examples/jms/ssl-enabled/pom.xml
index 47989bf0f5..7c6e4f82b2 100644
--- a/examples/jms/ssl-enabled/pom.xml
+++ b/examples/jms/ssl-enabled/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:5500?sslEnabled=true&trustStorePath=activemq/server0/activemq.example.truststore&trustStorePassword=activemqexample
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.SSLExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.java b/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.java
index 11f5a91464..a43e4c00c6 100644
--- a/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.java
+++ b/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.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 SSL secure transport.
*/
-public class SSLExample extends ActiveMQExample
+public class SSLExample
{
- public static void main(final String[] args)
- {
- new SSLExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -82,8 +74,6 @@ public class SSLExample extends ActiveMQExample
System.out.println("Received message: " + messageReceived.getText());
initialContext.close();
-
- return true;
}
finally
{
@@ -98,5 +88,4 @@ public class SSLExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/static-selector-jms/pom.xml b/examples/jms/static-selector-jms/pom.xml
index 750af0002f..02b8fb7038 100644
--- a/examples/jms/static-selector-jms/pom.xml
+++ b/examples/jms/static-selector-jms/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.StaticSelectorJMSExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
@@ -91,6 +103,4 @@ under the License.
-
-
diff --git a/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorJMSExample.java b/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorJMSExample.java
index 16c22e5cbf..0f064175df 100644
--- a/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorJMSExample.java
+++ b/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorJMSExample.java
@@ -27,24 +27,16 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* A simple JMS example that shows how static message selectors work when using JMS config.
*/
-public class StaticSelectorJMSExample extends ActiveMQExample
+public class StaticSelectorJMSExample
{
- private volatile boolean result = true;
-
- public static void main(final String[] args)
- {
- new StaticSelectorJMSExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ AtomicBoolean result = new AtomicBoolean(true);
Connection connection = null;
InitialContext initialContext = null;
try
@@ -73,7 +65,7 @@ public class StaticSelectorJMSExample extends ActiveMQExample
// Step 8. Create a JMS Message Consumer that receives 'red' messages
MessageConsumer redConsumer = session.createConsumer(queue);
- redConsumer.setMessageListener(new SimpleMessageListener("red"));
+ redConsumer.setMessageListener(new SimpleMessageListener("red", result));
// Step 9. Create five messages with different 'color' properties
TextMessage redMessage1 = session.createTextMessage("Red-1");
@@ -101,7 +93,8 @@ public class StaticSelectorJMSExample extends ActiveMQExample
// Step 11. Waiting for the message listener to check the received messages.
Thread.sleep(5000);
- return result;
+ if (!result.get())
+ throw new IllegalStateException();
}
finally
{
@@ -116,38 +109,39 @@ public class StaticSelectorJMSExample extends ActiveMQExample
}
}
}
+}
- public class SimpleMessageListener implements MessageListener
+class SimpleMessageListener implements MessageListener
+{
+ private final String name;
+ private AtomicBoolean result;
+
+ public SimpleMessageListener(final String listener, AtomicBoolean result)
{
- private final String name;
-
- public SimpleMessageListener(final String listener)
- {
- name = listener;
- }
-
- public void onMessage(final Message msg)
- {
- TextMessage textMessage = (TextMessage)msg;
- try
- {
- String colorProp = msg.getStringProperty("color");
- System.out.println("Receiver " + name +
- " receives message [" +
- textMessage.getText() +
- "] with color property: " +
- colorProp);
- if (colorProp != null && !colorProp.equals(name))
- {
- result = false;
- }
- }
- catch (JMSException e)
- {
- e.printStackTrace();
- result = false;
- }
- }
+ name = listener;
+ this.result = result;
}
+ public void onMessage(final Message msg)
+ {
+ TextMessage textMessage = (TextMessage)msg;
+ try
+ {
+ String colorProp = msg.getStringProperty("color");
+ System.out.println("Receiver " + name +
+ " receives message [" +
+ textMessage.getText() +
+ "] with color property: " +
+ colorProp);
+ if (colorProp != null && !colorProp.equals(name))
+ {
+ result.set(false);
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ result.set(false);
+ }
+ }
}
\ No newline at end of file
diff --git a/examples/jms/static-selector-jms/src/main/resources/activemq/server0/broker.xml b/examples/jms/static-selector-jms/src/main/resources/activemq/server0/broker.xml
index 7442fac3fa..cdeb5343e0 100644
--- a/examples/jms/static-selector-jms/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/static-selector-jms/src/main/resources/activemq/server0/broker.xml
@@ -31,13 +31,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:../data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:../data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:../data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:../data}/paging
diff --git a/examples/jms/static-selector/pom.xml b/examples/jms/static-selector/pom.xml
index cf08771d58..54881c9e8d 100644
--- a/examples/jms/static-selector/pom.xml
+++ b/examples/jms/static-selector/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.StaticSelectorExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/static-selector/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorExample.java b/examples/jms/static-selector/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorExample.java
index b8449940f3..532ca50bc6 100644
--- a/examples/jms/static-selector/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorExample.java
+++ b/examples/jms/static-selector/src/main/java/org/apache/activemq/artemis/jms/example/StaticSelectorExample.java
@@ -27,24 +27,16 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* A simple JMS example that shows how static message selectors work.
*/
-public class StaticSelectorExample extends ActiveMQExample
+public class StaticSelectorExample
{
- private volatile boolean result = true;
-
- public static void main(final String[] args)
- {
- new StaticSelectorExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ AtomicBoolean result = new AtomicBoolean(true);
Connection connection = null;
InitialContext initialContext = null;
try
@@ -73,7 +65,7 @@ public class StaticSelectorExample extends ActiveMQExample
// Step 8. Create a JMS Message Consumer that receives 'red' messages
MessageConsumer redConsumer = session.createConsumer(queue);
- redConsumer.setMessageListener(new SimpleMessageListener("red"));
+ redConsumer.setMessageListener(new SimpleMessageListener("red", result));
// Step 9. Create five messages with different 'color' properties
TextMessage redMessage1 = session.createTextMessage("Red-1");
@@ -101,7 +93,8 @@ public class StaticSelectorExample extends ActiveMQExample
// Step 11. Waiting for the message listener to check the received messages.
Thread.sleep(5000);
- return result;
+ if (!result.get())
+ throw new IllegalStateException();
}
finally
{
@@ -116,38 +109,40 @@ public class StaticSelectorExample extends ActiveMQExample
}
}
}
+}
- public class SimpleMessageListener implements MessageListener
+
+class SimpleMessageListener implements MessageListener
+{
+ private final String name;
+ private AtomicBoolean result;
+
+ public SimpleMessageListener(final String listener, AtomicBoolean result)
{
- private final String name;
-
- public SimpleMessageListener(final String listener)
- {
- name = listener;
- }
-
- public void onMessage(final Message msg)
- {
- TextMessage textMessage = (TextMessage)msg;
- try
- {
- String colorProp = msg.getStringProperty("color");
- System.out.println("Receiver " + name +
- " receives message [" +
- textMessage.getText() +
- "] with color property: " +
- colorProp);
- if (colorProp != null && !colorProp.equals(name))
- {
- result = false;
- }
- }
- catch (JMSException e)
- {
- e.printStackTrace();
- result = false;
- }
- }
+ name = listener;
+ this.result = result;
}
+ public void onMessage(final Message msg)
+ {
+ TextMessage textMessage = (TextMessage)msg;
+ try
+ {
+ String colorProp = msg.getStringProperty("color");
+ System.out.println("Receiver " + name +
+ " receives message [" +
+ textMessage.getText() +
+ "] with color property: " +
+ colorProp);
+ if (colorProp != null && !colorProp.equals(name))
+ {
+ result.set(false);
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ result.set(false);
+ }
+ }
}
diff --git a/examples/jms/stomp-websockets/pom.xml b/examples/jms/stomp-websockets/pom.xml
index d64b66dccb..64c3ced878 100644
--- a/examples/jms/stomp-websockets/pom.xml
+++ b/examples/jms/stomp-websockets/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.StompWebSocketExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java b/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java
index fcaa63a6ff..7260a091d9 100644
--- a/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java
+++ b/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java
@@ -27,21 +27,13 @@ import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* An example where a client will send a JMS message to a Topic.
* Browser clients connected using Web Sockets will be able to receive the message.
*/
-public class StompWebSocketExample extends ActiveMQExample
+public class StompWebSocketExample
{
- public static void main(final String[] args)
- {
- new StompWebSocketExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -70,8 +62,6 @@ public class StompWebSocketExample extends ActiveMQExample
message = (TextMessage)consumer.receive();
System.out.println("Received message: " + message.getText());
-
- return true;
}
finally
{
diff --git a/examples/jms/stomp-websockets/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/stomp-websockets/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stomp-websockets/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
diff --git a/examples/jms/stomp-websockets/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/stomp-websockets/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stomp-websockets/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
diff --git a/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml
index ce256a9f7f..efceecf8e5 100644
--- a/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/stomp/pom.xml b/examples/jms/stomp/pom.xml
index 809e433ee5..867827d5cf 100644
--- a/examples/jms/stomp/pom.xml
+++ b/examples/jms/stomp/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.StompExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java b/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
index bf10f6f981..0d4f28f3e0 100644
--- a/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
+++ b/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
@@ -29,24 +29,15 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* An example where a client will send a Stomp message on a TCP socket
* and consume it from a JMS MessageConsumer.
*/
-public class StompExample extends ActiveMQExample
+public class StompExample
{
private static final String END_OF_FRAME = "\u0000";
- public static void main(final String[] args)
- {
- new StompExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -58,11 +49,11 @@ public class StompExample extends ActiveMQExample
// Step 2. Send a CONNECT frame to connect to the server
String connectFrame = "CONNECT\n" +
- "login: guest\n" +
- "passcode: guest\n" +
- "request-id: 1\n" +
- "\n" +
- END_OF_FRAME;
+ "login: guest\n" +
+ "passcode: guest\n" +
+ "request-id: 1\n" +
+ "\n" +
+ END_OF_FRAME;
sendFrame(socket, connectFrame);
readFrame(socket);
@@ -71,17 +62,17 @@ public class StompExample extends ActiveMQExample
// jms.queue.exampleQueue address with a text body
String text = "Hello, world from Stomp!";
String message = "SEND\n" +
- "destination: jms.queue.exampleQueue\n" +
- "\n" +
- text +
- END_OF_FRAME;
+ "destination: jms.queue.exampleQueue\n" +
+ "\n" +
+ text +
+ END_OF_FRAME;
sendFrame(socket, message);
System.out.println("Sent Stomp message: " + text);
// Step 4. Send a DISCONNECT frame to disconnect from the server
String disconnectFrame = "DISCONNECT\n" +
- "\n" +
- END_OF_FRAME;
+ "\n" +
+ END_OF_FRAME;
sendFrame(socket, disconnectFrame);
// Step 5. Slose the TCP socket
@@ -107,8 +98,6 @@ public class StompExample extends ActiveMQExample
// Step 10. Receive the message
TextMessage messageReceived = (TextMessage)consumer.receive(5000);
System.out.println("Received JMS message: " + messageReceived.getText());
-
- return true;
}
finally
{
diff --git a/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml
index b24f1da6bd..c0ada1eab1 100644
--- a/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:../data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:../data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:../data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:../data}/paging
diff --git a/examples/jms/stomp1.1/pom.xml b/examples/jms/stomp1.1/pom.xml
index 14e9a76483..b17e9c09f0 100644
--- a/examples/jms/stomp1.1/pom.xml
+++ b/examples/jms/stomp1.1/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.StompExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java b/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
index ee03b85fb6..7d3b3cc5bd 100644
--- a/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
+++ b/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
@@ -29,23 +29,15 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* An example where a Stomp 1.1 client sends a message on a TCP socket
* and consumes it from a JMS MessageConsumer.
*/
-public class StompExample extends ActiveMQExample
+public class StompExample
{
private static final String END_OF_FRAME = "\u0000";
- public static void main(final String[] args)
- {
- new StompExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -57,13 +49,13 @@ public class StompExample extends ActiveMQExample
// Step 2. Send a CONNECT frame to connect to the server
String connectFrame = "CONNECT\n" +
- "accept-version:1.1\n" +
- "host:localhost\n" +
- "login:guest\n" +
- "passcode:guest\n" +
- "request-id:1\n" +
- "\n" +
- END_OF_FRAME;
+ "accept-version:1.1\n" +
+ "host:localhost\n" +
+ "login:guest\n" +
+ "passcode:guest\n" +
+ "request-id:1\n" +
+ "\n" +
+ END_OF_FRAME;
sendFrame(socket, connectFrame);
String response = receiveFrame(socket);
@@ -73,17 +65,17 @@ public class StompExample extends ActiveMQExample
// jms.queue.exampleQueue address with a text body
String text = "Hello World from Stomp 1.1 !";
String message = "SEND\n" +
- "destination:jms.queue.exampleQueue\n" +
- "\n" +
- text +
- END_OF_FRAME;
+ "destination:jms.queue.exampleQueue\n" +
+ "\n" +
+ text +
+ END_OF_FRAME;
sendFrame(socket, message);
System.out.println("Sent Stomp message: " + text);
// Step 4. Send a DISCONNECT frame to disconnect from the server
String disconnectFrame = "DISCONNECT\n" +
- "\n" +
- END_OF_FRAME;
+ "\n" +
+ END_OF_FRAME;
sendFrame(socket, disconnectFrame);
// Step 5. Slose the TCP socket
@@ -109,8 +101,6 @@ public class StompExample extends ActiveMQExample
// Step 10. Receive the message
TextMessage messageReceived = (TextMessage)consumer.receive(5000);
System.out.println("Received JMS message: " + messageReceived.getText());
-
- return true;
}
finally
{
diff --git a/examples/jms/stomp1.1/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/stomp1.1/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stomp1.1/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
diff --git a/examples/jms/stomp1.1/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/stomp1.1/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stomp1.1/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
diff --git a/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml
index b24f1da6bd..9688ae9824 100644
--- a/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/stomp1.2/pom.xml b/examples/jms/stomp1.2/pom.xml
index c696d8b737..e673181ea9 100644
--- a/examples/jms/stomp1.2/pom.xml
+++ b/examples/jms/stomp1.2/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.StompExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java b/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
index f3a0ad7bff..fc978f7113 100644
--- a/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
+++ b/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
@@ -28,23 +28,15 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* An example where a Stomp 1.2 client sends a message on a TCP socket
* and consumes it from a JMS MessageConsumer.
*/
-public class StompExample extends ActiveMQExample
+public class StompExample
{
private static final String END_OF_FRAME = "\u0000";
- public static void main(final String[] args)
- {
- new StompExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -56,13 +48,13 @@ public class StompExample extends ActiveMQExample
// Step 2. Send a CONNECT frame to connect to the server
String connectFrame = "CONNECT\n" +
- "accept-version:1.2\n" +
- "host:localhost\n" +
- "login:guest\n" +
- "passcode:guest\n" +
- "request-id:1\n" +
- "\n" +
- END_OF_FRAME;
+ "accept-version:1.2\n" +
+ "host:localhost\n" +
+ "login:guest\n" +
+ "passcode:guest\n" +
+ "request-id:1\n" +
+ "\n" +
+ END_OF_FRAME;
sendFrame(socket, connectFrame);
String response = receiveFrame(socket);
@@ -72,17 +64,17 @@ public class StompExample extends ActiveMQExample
// jms.queue.exampleQueue address with a text body
String text = "Hello World from Stomp 1.2 !";
String message = "SEND\n" +
- "destination:jms.queue.exampleQueue\n" +
- "\n" +
- text +
- END_OF_FRAME;
+ "destination:jms.queue.exampleQueue\n" +
+ "\n" +
+ text +
+ END_OF_FRAME;
sendFrame(socket, message);
System.out.println("Sent Stomp message: " + text);
// Step 4. Send a DISCONNECT frame to disconnect from the server
String disconnectFrame = "DISCONNECT\n" +
- "\n" +
- END_OF_FRAME;
+ "\n" +
+ END_OF_FRAME;
sendFrame(socket, disconnectFrame);
// Step 5. Slose the TCP socket
@@ -108,8 +100,6 @@ public class StompExample extends ActiveMQExample
// Step 10. Receive the message
TextMessage messageReceived = (TextMessage)consumer.receive(5000);
System.out.println("Received JMS message: " + messageReceived.getText());
-
- return true;
}
finally
{
@@ -147,7 +137,5 @@ public class StompExample extends ActiveMQExample
String frame = new String(data, "UTF-8");
return frame;
-
}
-
}
diff --git a/examples/jms/stomp1.2/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/stomp1.2/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stomp1.2/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
diff --git a/examples/jms/stomp1.2/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/stomp1.2/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stomp1.2/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
diff --git a/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml
index b24f1da6bd..9688ae9824 100644
--- a/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/stop-server-failover/pom.xml b/examples/jms/stop-server-failover/pom.xml
index e1ebe90313..2ba5e695c6 100644
--- a/examples/jms/stop-server-failover/pom.xml
+++ b/examples/jms/stop-server-failover/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -57,25 +52,59 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
- -Dudp-address=${udp-address}
+ true
+ false
+ ../data
+ true
- create2
+ create1
create
${basedir}/target/server1
- ${basedir}/target/classes/activemq/server1
- -Dudp-address=${udp-address}
+ true
+ true
+ ../data
+ true
+
+
+
+ start0
+
+ cli
+
+
+ true
+ ${basedir}/target/server0
+ tcp://localhost:61616
+
+ run
+
+ server0
+
+
+
+ start1
+
+ cli
+
+
+ true
+ ${basedir}/target/server1
+ tcp://localhost:61617
+
+ run
+
+ server1
@@ -85,9 +114,29 @@ under the License.
org.apache.activemq.artemis.jms.example.StopServerFailoverExample
+
+
+
+ stop0
+
+ cli
+
+
+ ${basedir}/target/server0
- ${basedir}/target/server0
- ${basedir}/target/server1
+ stop
+
+
+
+
+ stop1
+
+ cli
+
+
+ ${basedir}/target/server1
+
+ stop
diff --git a/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java b/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java
index 7f170f6532..01ee51bd66 100644
--- a/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java
+++ b/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java
@@ -16,8 +16,6 @@
*/
package org.apache.activemq.artemis.jms.example;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
@@ -32,15 +30,9 @@ import javax.naming.InitialContext;
* A simple example that demonstrates failover of the JMS connection from one node to another
* when the live server crashes using a JMS non-transacted session.
*/
-public class StopServerFailoverExample extends ActiveMQExample
+public class StopServerFailoverExample
{
- public static void main(final String[] args)
- {
- new StopServerFailoverExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
final int numMessages = 10;
@@ -94,10 +86,9 @@ public class StopServerFailoverExample extends ActiveMQExample
System.out.println("Got message: " + message0.getText());
}
- // Step 10. Crash server #1, the live server, and wait a little while to make sure
+ // Step 10. Crash server #0, the live server, and wait a little while to make sure
// it has really crashed
- Thread.sleep(5000);
- System.out.println("stop the server by logging into jconsole");
+ System.out.println("Stop the live server by logging into JConsole and then press any key to continue...");
System.in.read();
// Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
@@ -118,8 +109,6 @@ public class StopServerFailoverExample extends ActiveMQExample
System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
}
message0.acknowledge();
-
- return true;
}
finally
{
@@ -136,5 +125,4 @@ public class StopServerFailoverExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/stop-server-failover/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/stop-server-failover/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stop-server-failover/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
diff --git a/examples/jms/stop-server-failover/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/stop-server-failover/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stop-server-failover/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
diff --git a/examples/jms/stop-server-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/stop-server-failover/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 6ea24c1a8d..0000000000
--- a/examples/jms/stop-server-failover/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
-
-
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- tcp://localhost:61616
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/stop-server-failover/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/stop-server-failover/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stop-server-failover/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
diff --git a/examples/jms/stop-server-failover/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/stop-server-failover/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/stop-server-failover/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
diff --git a/examples/jms/stop-server-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/stop-server-failover/src/main/resources/activemq/server1/broker.xml
deleted file mode 100644
index da69fce8d3..0000000000
--- a/examples/jms/stop-server-failover/src/main/resources/activemq/server1/broker.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
-
-
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- tcp://localhost:61617
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 1000
- netty-connector
-
-
-
-
-
- ${udp-address:231.7.7.7}
- 9876
- 60000
-
-
-
-
-
- jms
- netty-connector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/symmetric-cluster/pom.xml b/examples/jms/symmetric-cluster/pom.xml
index a7d35f7a2d..d6ed18946c 100644
--- a/examples/jms/symmetric-cluster/pom.xml
+++ b/examples/jms/symmetric-cluster/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-jms-client
${project.version}
@@ -57,7 +57,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -122,7 +122,96 @@ under the License.
-Dudp-address=${udp-address}
-
+
+ start0
+
+ cli
+
+
+ true
+ ${basedir}/target/server0
+ tcp://localhost:61616
+
+ run
+
+ server0
+
+
+
+ start1
+
+ cli
+
+
+ true
+ ${basedir}/target/server1
+ tcp://localhost:61617
+
+ run
+
+ server1
+
+
+
+ start2
+
+ cli
+
+
+ true
+ ${basedir}/target/server2
+ tcp://localhost:61618
+
+ run
+
+ server2
+
+
+
+ start3
+
+ cli
+
+
+ true
+ ${basedir}/target/server3
+ tcp://localhost:61619
+
+ run
+
+ server3
+
+
+
+ start4
+
+ cli
+
+
+ true
+ ${basedir}/target/server4
+ tcp://localhost:61620
+
+ run
+
+ server4
+
+
+
+ start5
+
+ cli
+
+
+ true
+ ${basedir}/target/server5
+ tcp://localhost:61621
+
+ run
+
+ server5
+
+
runClient
@@ -130,13 +219,77 @@ under the License.
org.apache.activemq.artemis.jms.example.SymmetricClusterExample
+
+
+
+ stop0
+
+ cli
+
+
+ ${basedir}/target/server0
- ${basedir}/target/server0
- ${basedir}/target/server1
- ${basedir}/target/server2
- ${basedir}/target/server3
- ${basedir}/target/server4
- ${basedir}/target/server5
+ stop
+
+
+
+
+ stop1
+
+ cli
+
+
+ ${basedir}/target/server1
+
+ stop
+
+
+
+
+ stop2
+
+ cli
+
+
+ ${basedir}/target/server2
+
+ stop
+
+
+
+
+ stop3
+
+ cli
+
+
+ ${basedir}/target/server3
+
+ stop
+
+
+
+
+ stop4
+
+ cli
+
+
+ ${basedir}/target/server4
+
+ stop
+
+
+
+
+ stop5
+
+ cli
+
+
+ ${basedir}/target/server5
+
+ stop
diff --git a/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java b/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java
index 24e75f0534..e332f04607 100644
--- a/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java
+++ b/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/artemis/jms/example/SymmetricClusterExample.java
@@ -29,7 +29,6 @@ import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
/**
* This example demonstrates a cluster of three nodes set up in a symmetric topology - i.e. each
@@ -48,15 +47,9 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample;
*
* Please see the readme.html file for more information.
*/
-public class SymmetricClusterExample extends ActiveMQExample
+public class SymmetricClusterExample
{
- public static void main(final String[] args)
- {
- new SymmetricClusterExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection0 = null;
@@ -180,53 +173,51 @@ public class SymmetricClusterExample extends ActiveMQExample
if (received0 == null)
{
- return false;
+ throw new IllegalStateException("Message is null!");
}
TextMessage received1 = (TextMessage)subscriber1.receive(5000);
if (received1 == null)
{
- return false;
+ throw new IllegalStateException("Message is null!");
}
TextMessage received2 = (TextMessage)subscriber2.receive(5000);
if (received2 == null)
{
- return false;
+ throw new IllegalStateException("Message is null!");
}
TextMessage received3 = (TextMessage)subscriber3.receive(5000);
if (received3 == null)
{
- return false;
+ throw new IllegalStateException("Message is null!");
}
TextMessage received4 = (TextMessage)subscriber4.receive(5000);
if (received4 == null)
{
- return false;
+ throw new IllegalStateException("Message is null!");
}
TextMessage received5 = (TextMessage)subscriber5.receive(5000);
if (received5 == null)
{
- return false;
+ throw new IllegalStateException("Message is null!");
}
TextMessage received6 = (TextMessage)consumer0.receive(5000);
if (received6 == null)
{
- return false;
+ throw new IllegalStateException("Message is null!");
}
}
-
- return true;
}
finally
{
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
index 27b74894a9..9c672d7cb5 100644
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
@@ -30,14 +30,13 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
index 16a7931959..f02759badf 100644
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
@@ -30,14 +30,13 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir}/server1/data/messaging/bindings
+ ${data.dir:./data}/journal
- ${data.dir}/server1/data/messaging/journal
+ ${data.dir:./data}/largemessages
- ${data.dir}/server1/data/messaging/largemessages
-
- ${data.dir}/server1/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/artemis-roles.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/artemis-users.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
index 30f33a0ae5..a188e71827 100644
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
+++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
@@ -30,14 +30,13 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir}/server2/data/messaging/bindings
+ ${data.dir:./data}/journal
- ${data.dir}/server2/data/messaging/journal
+ ${data.dir:./data}/largemessages
- ${data.dir}/server2/data/messaging/largemessages
-
- ${data.dir}/server2/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/artemis-roles.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/artemis-users.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
index afda21b6ca..43ab47c64f 100644
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
+++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
@@ -30,14 +30,13 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir}/server3/data/messaging/bindings
+ ${data.dir:./data}/journal
- ${data.dir}/server3/data/messaging/journal
+ ${data.dir:./data}/largemessages
- ${data.dir}/server3/data/messaging/largemessages
-
- ${data.dir}/server3/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/artemis-roles.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/artemis-users.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
index 321d57bb6f..ce4afab4ac 100644
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
+++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
@@ -30,14 +30,13 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir}/server4/data/messaging/bindings
+ ${data.dir:./data}/journal
- ${data.dir}/server4/data/messaging/journal
+ ${data.dir:./data}/largemessages
- ${data.dir}/server4/data/messaging/largemessages
-
- ${data.dir}/server4/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/artemis-roles.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/artemis-users.properties b/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/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
diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
index abbe9adfdc..d23612a37d 100644
--- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
+++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
@@ -30,23 +30,22 @@ under the License.
+ ${data.dir:./data}/bindings
- ${data.dir}/server5/data/messaging/bindings
+ ${data.dir:./data}/journal
- ${data.dir}/server5/data/messaging/journal
+ ${data.dir:./data}/largemessages
- ${data.dir}/server5/data/messaging/largemessages
-
- ${data.dir}/server5/data/messaging/paging
+ ${data.dir:./data}/paging
- tcp://localhost:5450
+ tcp://localhost:61621
- tcp://localhost:5450
+ tcp://localhost:61621
diff --git a/examples/jms/temp-queue/pom.xml b/examples/jms/temp-queue/pom.xml
index b21308895f..1599fcc387 100644
--- a/examples/jms/temp-queue/pom.xml
+++ b/examples/jms/temp-queue/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.TemporaryQueueExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java b/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java
index cd39f7fcda..a2f7d3841d 100644
--- a/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java
+++ b/examples/jms/temp-queue/src/main/java/org/apache/activemq/artemis/jms/example/TemporaryQueueExample.java
@@ -26,20 +26,12 @@ import javax.jms.TemporaryQueue;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS example that shows how to use temporary queues.
*/
-public class TemporaryQueueExample extends ActiveMQExample
+public class TemporaryQueueExample
{
- public static void main(final String[] args)
- {
- new TemporaryQueueExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -115,8 +107,6 @@ public class TemporaryQueueExample extends ActiveMQExample
{
System.out.println("Exception got when trying to access a temp queue outside its scope: " + e);
}
-
- return true;
}
finally
{
diff --git a/examples/jms/temp-queue/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/temp-queue/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/temp-queue/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
diff --git a/examples/jms/temp-queue/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/temp-queue/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/temp-queue/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
diff --git a/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml b/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml
index d5950867ff..f1c14b2db6 100644
--- a/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/temp-queue/src/main/resources/activemq/server0/broker.xml
@@ -29,19 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
-
-
-
-
- tcp://localhost:61616
-
+ ${data.dir:./data}/paging
@@ -49,8 +43,6 @@ under the License.
-
-
@@ -69,6 +61,5 @@ under the License.
-
diff --git a/examples/jms/topic-hierarchies/pom.xml b/examples/jms/topic-hierarchies/pom.xml
index 087570e730..250abd3aef 100644
--- a/examples/jms/topic-hierarchies/pom.xml
+++ b/examples/jms/topic-hierarchies/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-jms-client
${project.version}
@@ -61,9 +61,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +82,16 @@ under the License.
org.apache.activemq.artemis.jms.example.TopicHierarchyExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java b/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java
index 34fe27d81a..f2385baf07 100644
--- a/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java
+++ b/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java
@@ -27,22 +27,15 @@ import javax.jms.Topic;
import javax.naming.InitialContext;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
/**
* This example demonstrates how a JMS TopicSubscriber can be created to subscribe to a wild-card Topic.
*
* For more information please see the readme.html
*/
-public class TopicHierarchyExample extends ActiveMQExample
+public class TopicHierarchyExample
{
- public static void main(final String[] args)
- {
- new TopicHierarchyExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -113,12 +106,10 @@ public class TopicHierarchyExample extends ActiveMQExample
if (message != null)
{
- return false;
+ throw new IllegalStateException("Message was not null.");
}
System.out.println("Didn't received any more message: " + message);
-
- return true;
}
finally
{
@@ -133,5 +124,4 @@ public class TopicHierarchyExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic-hierarchies/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
diff --git a/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic-hierarchies/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
diff --git a/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/broker.xml b/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/broker.xml
index 1f94195d48..ac065f6af4 100644
--- a/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/topic-hierarchies/src/main/resources/activemq/server0/broker.xml
@@ -40,13 +40,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/topic-selector-example1/pom.xml b/examples/jms/topic-selector-example1/pom.xml
index 7526dd53d4..bbf95ee9a6 100644
--- a/examples/jms/topic-selector-example1/pom.xml
+++ b/examples/jms/topic-selector-example1/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.TopicSelectorExample1
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java b/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java
index 5116a76cad..28c128ed02 100644
--- a/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java
+++ b/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java
@@ -25,20 +25,12 @@ import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS Topic example that creates a producer and consumer on a queue and sends and receives a message.
*/
-public class TopicSelectorExample1 extends ActiveMQExample
+public class TopicSelectorExample1
{
- public static void main(final String[] args)
- {
- new TopicSelectorExample1().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
@@ -81,8 +73,8 @@ public class TopicSelectorExample1 extends ActiveMQExample
{
// Step 10.1 Create a text message
TextMessage message1 = session.createTextMessage("This is a text message " + i +
- " sent for someID=" +
- someID);
+ " sent for someID=" +
+ someID);
// Step 10.1 Set a property
message1.setIntProperty("someID", someID);
@@ -110,8 +102,8 @@ public class TopicSelectorExample1 extends ActiveMQExample
}
System.out.println("messageConsumer1 received " + messageReceivedA.getText() +
- " someID = " +
- messageReceivedA.getIntProperty("someID"));
+ " someID = " +
+ messageReceivedA.getIntProperty("someID"));
}
// Step 13. Consume the messages from MessageConsumer2, filtering out someID=2
@@ -126,8 +118,8 @@ public class TopicSelectorExample1 extends ActiveMQExample
}
System.out.println("messageConsumer2 received " + messageReceivedB.getText() +
- " someID = " +
- messageReceivedB.getIntProperty("someID"));
+ " someID = " +
+ messageReceivedB.getIntProperty("someID"));
}
// Step 14. Consume the messages from MessageConsumer3, receiving the complete set of messages
@@ -141,17 +133,14 @@ public class TopicSelectorExample1 extends ActiveMQExample
break;
}
System.out.println("messageConsumer3 received " + messageReceivedC.getText() +
- " someID = " +
- messageReceivedC.getIntProperty("someID"));
+ " someID = " +
+ messageReceivedC.getIntProperty("someID"));
}
// Step 15. Close the subscribers
messageConsumer1.close();
messageConsumer2.close();
messageConsumer3.close();
-
- return true;
-
}
finally
{
diff --git a/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic-selector-example1/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
diff --git a/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic-selector-example1/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
diff --git a/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/broker.xml b/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/broker.xml
index e7c1a14cbd..4a4b5056cf 100644
--- a/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/topic-selector-example1/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/topic-selector-example2/pom.xml b/examples/jms/topic-selector-example2/pom.xml
index 320d13ce61..b9f5332de0 100644
--- a/examples/jms/topic-selector-example2/pom.xml
+++ b/examples/jms/topic-selector-example2/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.TopicSelectorExample2
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample2.java b/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample2.java
index 301b752cec..e80d22d99b 100644
--- a/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample2.java
+++ b/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample2.java
@@ -27,24 +27,16 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.InitialContext;
-
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* A simple JMS example that consumes messages using selectors.
*/
-public class TopicSelectorExample2 extends ActiveMQExample
+public class TopicSelectorExample2
{
- private volatile boolean result = true;
-
- public static void main(final String[] args)
- {
- new TopicSelectorExample2().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ AtomicBoolean result = new AtomicBoolean(true);
Connection connection = null;
InitialContext initialContext = null;
try
@@ -65,33 +57,36 @@ public class TopicSelectorExample2 extends ActiveMQExample
connection.start();
// Step 6. Create a JMS Session
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Step 7. Create a Message Producer
- MessageProducer producer = session.createProducer(topic);
+ MessageProducer producer = producerSession.createProducer(topic);
// Step 8. Prepare two selectors
String redSelector = "color='red'";
String greenSelector = "color='green'";
// Step 9. Create a JMS Message Consumer that receives 'red' messages
- MessageConsumer redConsumer = session.createConsumer(topic, redSelector);
- redConsumer.setMessageListener(new SimpleMessageListener("red"));
+ Session redSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer redConsumer = redSession.createConsumer(topic, redSelector);
+ redConsumer.setMessageListener(new SimpleMessageListener("red", result));
// Step 10. Create a second JMS message consumer that receives 'green' messages
- MessageConsumer greenConsumer = session.createConsumer(topic, greenSelector);
- greenConsumer.setMessageListener(new SimpleMessageListener("green"));
+ Session greenSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer greenConsumer = greenSession.createConsumer(topic, greenSelector);
+ greenConsumer.setMessageListener(new SimpleMessageListener("green", result));
// Step 11. Create another JMS message consumer that receives all messages.
- MessageConsumer allConsumer = session.createConsumer(topic);
- allConsumer.setMessageListener(new SimpleMessageListener("all"));
+ Session allSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer allConsumer = allSession.createConsumer(topic);
+ allConsumer.setMessageListener(new SimpleMessageListener("all", result));
// Step 12. Create three messages, each has a color property
- TextMessage redMessage = session.createTextMessage("Red");
+ TextMessage redMessage = producerSession.createTextMessage("Red");
redMessage.setStringProperty("color", "red");
- TextMessage greenMessage = session.createTextMessage("Green");
+ TextMessage greenMessage = producerSession.createTextMessage("Green");
greenMessage.setStringProperty("color", "green");
- TextMessage blueMessage = session.createTextMessage("Blue");
+ TextMessage blueMessage = producerSession.createTextMessage("Blue");
blueMessage.setStringProperty("color", "blue");
// Step 13. Send the Messages
@@ -104,7 +99,8 @@ public class TopicSelectorExample2 extends ActiveMQExample
Thread.sleep(5000);
- return result;
+ if (!result.get())
+ throw new IllegalStateException();
}
finally
{
@@ -121,39 +117,39 @@ public class TopicSelectorExample2 extends ActiveMQExample
}
}
}
-
- public class SimpleMessageListener implements MessageListener
- {
-
- private final String name;
-
- public SimpleMessageListener(final String listener)
- {
- name = listener;
- }
-
- public void onMessage(final Message msg)
- {
- TextMessage textMessage = (TextMessage)msg;
- try
- {
- String colorProp = msg.getStringProperty("color");
- System.out.println("Receiver " + name +
- " receives message [" +
- textMessage.getText() +
- "] with color property: " +
- colorProp);
- if (!colorProp.equals(name) && !name.equals("all"))
- {
- result = false;
- }
- }
- catch (JMSException e)
- {
- e.printStackTrace();
- result = false;
- }
- }
-
- }
}
+
+class SimpleMessageListener implements MessageListener
+{
+ private final String name;
+ AtomicBoolean result;
+
+ public SimpleMessageListener(final String listener, AtomicBoolean result)
+ {
+ name = listener;
+ this.result = result;
+ }
+
+ public void onMessage(final Message msg)
+ {
+ TextMessage textMessage = (TextMessage)msg;
+ try
+ {
+ String colorProp = msg.getStringProperty("color");
+ System.out.println("Receiver " + name +
+ " receives message [" +
+ textMessage.getText() +
+ "] with color property: " +
+ colorProp);
+ if (!colorProp.equals(name) && !name.equals("all"))
+ {
+ result.set(false);
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ result.set(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic-selector-example2/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
diff --git a/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic-selector-example2/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
diff --git a/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/broker.xml b/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/broker.xml
index e7c1a14cbd..4a4b5056cf 100644
--- a/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/topic-selector-example2/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
diff --git a/examples/jms/topic/pom.xml b/examples/jms/topic/pom.xml
index 0fe39ff25a..2c6a91a091 100644
--- a/examples/jms/topic/pom.xml
+++ b/examples/jms/topic/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -60,9 +55,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -72,8 +76,16 @@ under the License.
org.apache.activemq.artemis.jms.example.TopicExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
@@ -90,5 +102,4 @@ under the License.
-
diff --git a/examples/jms/topic/src/main/java/org/apache/activemq/artemis/jms/example/TopicExample.java b/examples/jms/topic/src/main/java/org/apache/activemq/artemis/jms/example/TopicExample.java
index 0564525e44..08ca057b8e 100644
--- a/examples/jms/topic/src/main/java/org/apache/activemq/artemis/jms/example/TopicExample.java
+++ b/examples/jms/topic/src/main/java/org/apache/activemq/artemis/jms/example/TopicExample.java
@@ -25,20 +25,12 @@ import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple JMS Topic example that creates a producer and consumer on a queue and sends and receives a message.
*/
-public class TopicExample extends ActiveMQExample
+public class TopicExample
{
- public static void main(final String[] args)
- {
- new TopicExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -88,8 +80,6 @@ public class TopicExample extends ActiveMQExample
messageReceived = (TextMessage)messageConsumer2.receive();
System.out.println("Consumer 2 Received message: " + messageReceived.getText());
-
- return true;
}
finally
{
diff --git a/examples/jms/topic/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/topic/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic/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
diff --git a/examples/jms/topic/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/topic/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/topic/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
diff --git a/examples/jms/topic/src/main/resources/activemq/server0/broker.xml b/examples/jms/topic/src/main/resources/activemq/server0/broker.xml
index e7c1a14cbd..f379d5533c 100644
--- a/examples/jms/topic/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/topic/src/main/resources/activemq/server0/broker.xml
@@ -29,13 +29,13 @@ under the License.
- ${data.dir}/server0/data/messaging/bindings
+ ${data.dir:./data}/bindings
- ${data.dir}/server0/data/messaging/journal
+ ${data.dir:./data}/journal
- ${data.dir}/server0/data/messaging/largemessages
+ ${data.dir:./data}/largemessages
- ${data.dir}/server0/data/messaging/paging
+ ${data.dir:./data}/paging
@@ -43,7 +43,6 @@ under the License.
-
diff --git a/examples/jms/transaction-failover/pom.xml b/examples/jms/transaction-failover/pom.xml
index f9544780f5..0fe0ec87cd 100644
--- a/examples/jms/transaction-failover/pom.xml
+++ b/examples/jms/transaction-failover/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-cli
${project.version}
@@ -57,7 +57,7 @@ under the License.
artemis-maven-plugin
- create
+ create0
create
@@ -68,7 +68,7 @@ under the License.
- create2
+ create1
create
diff --git a/examples/jms/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java b/examples/jms/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java
index 49986496cd..119bdf8f98 100644
--- a/examples/jms/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java
+++ b/examples/jms/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java
@@ -16,6 +16,9 @@
*/
package org.apache.activemq.artemis.jms.example;
+import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.util.ServerUtil;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -26,30 +29,23 @@ import javax.jms.TextMessage;
import javax.jms.TransactionRolledBackException;
import javax.naming.InitialContext;
-import org.apache.activemq.artemis.api.core.Message;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
/**
* A simple example that demonstrates failover of the JMS connection from one node to another
* when the live server crashes using a JMS transacted session.
*/
-public class TransactionFailoverExample extends ActiveMQExample
+public class TransactionFailoverExample
{
-
- public static void main(final String[] args)
- {
- new TransactionFailoverExample().run(args);
- }
-
// You need to guarantee uniqueIDs when using duplicate detection
// It needs to be unique even after a restart
// as these IDs are stored on the journal for control
// We recommend some sort of UUID, but for this example the Current Time as string would be enough
- String uniqueID = Long.toString(System.currentTimeMillis());
+ static String uniqueID = Long.toString(System.currentTimeMillis());
+ private static Process server0;
- @Override
- public boolean runExample() throws Exception
+ private static Process server1;
+
+ public static void main(final String[] args) throws Exception
{
final int numMessages = 10;
@@ -59,6 +55,9 @@ public class TransactionFailoverExample extends ActiveMQExample
try
{
+ server0 = ServerUtil.startServer(args[0], TransactionFailoverExample.class.getSimpleName() + "0", 0, 5000);
+ server1 = ServerUtil.startServer(args[1], TransactionFailoverExample.class.getSimpleName() + "1", 1, 5000);
+
// Step 1. Get an initial context for looking up JNDI from the server #1
initialContext = new InitialContext();
@@ -109,9 +108,7 @@ public class TransactionFailoverExample extends ActiveMQExample
if (message0 == null)
{
- System.err.println("Example failed - message wasn't received");
-
- return false;
+ throw new IllegalStateException("Example failed - message wasn't received");
}
System.out.println("Got message: " + message0.getText());
@@ -120,8 +117,6 @@ public class TransactionFailoverExample extends ActiveMQExample
session.commit();
System.out.println("Other message on the server? " + consumer.receive(5000));
-
- return true;
}
finally
{
@@ -136,10 +131,13 @@ public class TransactionFailoverExample extends ActiveMQExample
{
initialContext.close();
}
+
+ ServerUtil.killServer(server0);
+ ServerUtil.killServer(server1);
}
}
- private void sendMessages(final Session session,
+ private static void sendMessages(final Session session,
final MessageProducer producer,
final int numMessages,
final boolean killServer) throws Exception
@@ -161,8 +159,7 @@ public class TransactionFailoverExample extends ActiveMQExample
{
Thread.sleep(5000);
- killServer(0);
-
+ ServerUtil.killServer(server0);
}
// We send the remaining half of messages
@@ -180,5 +177,4 @@ public class TransactionFailoverExample extends ActiveMQExample
System.out.println("Sent message: " + message.getText());
}
}
-
}
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/transaction-failover/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/transaction-failover/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
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/transaction-failover/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/transaction-failover/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
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml
index 74a66d4cb5..916fdf5903 100644
--- a/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml
+++ b/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml
@@ -29,17 +29,19 @@ under the License.
- ../../data/messaging/bindings
+ ../data/bindings
- ../../data/messaging/journal
+ ../data/journal
- ../../data/messaging/largemessages
+ ../data/largemessages
- ../../data/messaging/paging
+ ../data/paging
-
+
+ true
+
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/transaction-failover/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/transaction-failover/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
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/transaction-failover/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/transaction-failover/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
diff --git a/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml
index 62e5154432..055f04a71d 100644
--- a/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml
+++ b/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml
@@ -29,17 +29,19 @@ under the License.
- ../../data/messaging/bindings
+ ../data/bindings
- ../../data/messaging/journal
+ ../data/journal
- ../../data/messaging/largemessages
+ ../data/largemessages
- ../../data/messaging/paging
+ ../data/paging
-
+
+ true
+
diff --git a/examples/jms/transactional/pom.xml b/examples/jms/transactional/pom.xml
index 7461ed67d8..902912495f 100644
--- a/examples/jms/transactional/pom.xml
+++ b/examples/jms/transactional/pom.xml
@@ -36,11 +36,6 @@ under the License.
-
- org.apache.activemq.examples.jms
- common
- ${project.version}
-
org.apache.geronimo.specs
geronimo-jms_2.0_spec
@@ -61,9 +56,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -73,8 +77,16 @@ under the License.
org.apache.activemq.artemis.jms.example.TransactionalExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/transactional/src/main/java/org/apache/activemq/artemis/jms/example/TransactionalExample.java b/examples/jms/transactional/src/main/java/org/apache/activemq/artemis/jms/example/TransactionalExample.java
index 56b21f5336..794b76f394 100644
--- a/examples/jms/transactional/src/main/java/org/apache/activemq/artemis/jms/example/TransactionalExample.java
+++ b/examples/jms/transactional/src/main/java/org/apache/activemq/artemis/jms/example/TransactionalExample.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 sends and consume message transactionally.
*/
-public class TransactionalExample extends ActiveMQExample
+public class TransactionalExample
{
- public static void main(final String[] args)
- {
- new TransactionalExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
Connection connection = null;
InitialContext initialContext = null;
@@ -117,13 +109,11 @@ public class TransactionalExample extends ActiveMQExample
if (receivedMessage != null)
{
// This was not supposed to happen
- return false;
+ throw new IllegalStateException("Message is not null.");
}
System.out.println("Message received after receive commit: " + receivedMessage);
- return true;
-
}
finally
{
@@ -139,5 +129,4 @@ public class TransactionalExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/transactional/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/transactional/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/transactional/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
diff --git a/examples/jms/transactional/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/transactional/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/transactional/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
diff --git a/examples/jms/transactional/src/main/resources/activemq/server0/broker.xml b/examples/jms/transactional/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/transactional/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/xa-heuristic/pom.xml b/examples/jms/xa-heuristic/pom.xml
index da401e3ec9..ada7aafe11 100644
--- a/examples/jms/xa-heuristic/pom.xml
+++ b/examples/jms/xa-heuristic/pom.xml
@@ -37,8 +37,13 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-core-client
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-commons
${project.version}
@@ -62,11 +67,22 @@ under the License.
create
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
+
+ start
+
+ cli
+
+
+ true
+ tcp://localhost:61616
+
+ run
+
+
+
runClient
@@ -74,8 +90,16 @@ under the License.
org.apache.activemq.artemis.jms.example.XAHeuristicExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java
new file mode 100644
index 0000000000..2b8a200528
--- /dev/null
+++ b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.jms.example;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq.artemis.utils.Base64;
+
+public class DummyXid implements Xid
+{
+ private static final long serialVersionUID = 407053232840068514L;
+
+ private final byte[] branchQualifier;
+
+ private final int formatId;
+
+ private final byte[] globalTransactionId;
+
+ private int hash;
+
+ private boolean hashCalculated;
+
+ // Static --------------------------------------------------------
+
+ public static String toBase64String(final Xid xid)
+ {
+ return Base64.encodeBytes(DummyXid.toByteArray(xid));
+ }
+
+ private static byte[] toByteArray(final Xid xid)
+ {
+ byte[] branchQualifier = xid.getBranchQualifier();
+ byte[] globalTransactionId = xid.getGlobalTransactionId();
+ int formatId = xid.getFormatId();
+
+ byte[] hashBytes = new byte[branchQualifier.length + globalTransactionId.length + 4];
+ System.arraycopy(branchQualifier, 0, hashBytes, 0, branchQualifier.length);
+ System.arraycopy(globalTransactionId, 0, hashBytes, branchQualifier.length, globalTransactionId.length);
+ byte[] intBytes = new byte[4];
+ for (int i = 0; i < 4; i++)
+ {
+ intBytes[i] = (byte)((formatId >> i * 8) % 0xFF);
+ }
+ System.arraycopy(intBytes, 0, hashBytes, branchQualifier.length + globalTransactionId.length, 4);
+ return hashBytes;
+ }
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * Standard constructor
+ * @param branchQualifier
+ * @param formatId
+ * @param globalTransactionId
+ */
+ public DummyXid(final byte[] branchQualifier, final int formatId, final byte[] globalTransactionId)
+ {
+ this.branchQualifier = branchQualifier;
+ this.formatId = formatId;
+ this.globalTransactionId = globalTransactionId;
+ }
+
+ /**
+ * Copy constructor
+ * @param other
+ */
+ public DummyXid(final Xid other)
+ {
+ branchQualifier = copyBytes(other.getBranchQualifier());
+ formatId = other.getFormatId();
+ globalTransactionId = copyBytes(other.getGlobalTransactionId());
+ }
+
+ // Xid implementation ------------------------------------------------------------------
+
+ public byte[] getBranchQualifier()
+ {
+ return branchQualifier;
+ }
+
+ public int getFormatId()
+ {
+ return formatId;
+ }
+
+ public byte[] getGlobalTransactionId()
+ {
+ return globalTransactionId;
+ }
+
+ // Public -------------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ if (!hashCalculated)
+ {
+ calcHash();
+ }
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (this == other)
+ {
+ return true;
+ }
+ if (!(other instanceof Xid))
+ {
+ return false;
+ }
+ Xid xother = (Xid)other;
+ if (xother.getFormatId() != formatId)
+ {
+ return false;
+ }
+ if (xother.getBranchQualifier().length != branchQualifier.length)
+ {
+ return false;
+ }
+ if (xother.getGlobalTransactionId().length != globalTransactionId.length)
+ {
+ return false;
+ }
+ for (int i = 0; i < branchQualifier.length; i++)
+ {
+ byte[] otherBQ = xother.getBranchQualifier();
+ if (branchQualifier[i] != otherBQ[i])
+ {
+ return false;
+ }
+ }
+ for (int i = 0; i < globalTransactionId.length; i++)
+ {
+ byte[] otherGtx = xother.getGlobalTransactionId();
+ if (globalTransactionId[i] != otherGtx[i])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "XidImpl (" + System.identityHashCode(this) +
+ " bq:" +
+ stringRep(branchQualifier) +
+ " formatID:" +
+ formatId +
+ " gtxid:" +
+ stringRep(globalTransactionId);
+ }
+
+ // Private -------------------------------------------------------------------------------
+
+ private String stringRep(final byte[] bytes)
+ {
+ StringBuilder buff = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++)
+ {
+ byte b = bytes[i];
+
+ buff.append(b);
+
+ if (i != bytes.length - 1)
+ {
+ buff.append('.');
+ }
+ }
+
+ return buff.toString();
+ }
+
+ private void calcHash()
+ {
+ byte[] hashBytes = org.apache.activemq.artemis.jms.example.DummyXid.toByteArray(this);
+ String s = new String(hashBytes);
+ hash = s.hashCode();
+ hashCalculated = true;
+ }
+
+ private byte[] copyBytes(final byte[] other)
+ {
+ byte[] bytes = new byte[other.length];
+
+ System.arraycopy(other, 0, bytes, 0, other.length);
+
+ return bytes;
+ }
+}
diff --git a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java
index 09232e3009..4da5c83329 100644
--- a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java
+++ b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java
@@ -40,29 +40,19 @@ import java.util.ArrayList;
import java.util.HashMap;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.utils.UUIDGenerator;
/**
* A simple JMS example showing how to administer un-finished transactions.
*/
-public class XAHeuristicExample extends ActiveMQExample
+public class XAHeuristicExample
{
- private volatile boolean result = true;
-
- private final ArrayList receiveHolder = new ArrayList();
-
private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3001/jmxrmi";
- public static void main(final String[] args)
- {
- new XAHeuristicExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ Boolean result = true;
+ final ArrayList receiveHolder = new ArrayList();
XAConnection connection = null;
InitialContext initialContext = null;
try
@@ -90,7 +80,7 @@ public class XAHeuristicExample extends ActiveMQExample
// Step 8. Create a normal Message Consumer
MessageConsumer normalConsumer = normalSession.createConsumer(queue);
- normalConsumer.setMessageListener(new SimpleMessageListener());
+ normalConsumer.setMessageListener(new SimpleMessageListener(receiveHolder, result));
// Step 9. Get the JMS Session
Session session = xaSession.getSession();
@@ -104,8 +94,8 @@ public class XAHeuristicExample extends ActiveMQExample
// Step 12. create a transaction
Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.ISO_8859_1), 1, UUIDGenerator.getInstance()
- .generateStringUUID()
- .getBytes());
+ .generateStringUUID()
+ .getBytes());
// Step 13. Get the JMS XAResource
XAResource xaRes = xaSession.getXAResource();
@@ -125,12 +115,12 @@ public class XAHeuristicExample extends ActiveMQExample
xaRes.prepare(xid1);
// Step 18. Check none should be received
- checkNoMessageReceived();
+ checkNoMessageReceived(receiveHolder);
// Step 19. Create another transaction.
Xid xid2 = new DummyXid("xa-example2".getBytes(), 1, UUIDGenerator.getInstance()
- .generateStringUUID()
- .getBytes());
+ .generateStringUUID()
+ .getBytes());
// Step 20. Begin the transaction work
xaRes.start(xid2, XAResource.TMNOFLAGS);
@@ -147,7 +137,7 @@ public class XAHeuristicExample extends ActiveMQExample
xaRes.prepare(xid2);
// Step 24. Again, no messages should be received!
- checkNoMessageReceived();
+ checkNoMessageReceived(receiveHolder);
// Step 25. Create JMX Connector to connect to the server's MBeanServer
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap());
@@ -180,7 +170,7 @@ public class XAHeuristicExample extends ActiveMQExample
Thread.sleep(2000);
// Step 30. Check the result, only the 'world' message received
- checkMessageReceived("world");
+ checkMessageReceived("world", receiveHolder);
// Step 31. Check the prepared transaction again, should have none.
infos = (String[])mbsc.invoke(serverObject, "listPreparedTransactions", null, null);
@@ -188,8 +178,6 @@ public class XAHeuristicExample extends ActiveMQExample
// Step 32. Close the JMX Connector
connector.close();
-
- return result;
}
finally
{
@@ -205,48 +193,52 @@ public class XAHeuristicExample extends ActiveMQExample
}
}
- private void checkMessageReceived(final String value)
+ private static void checkMessageReceived(final String value, ArrayList receiveHolder)
{
if (receiveHolder.size() != 1)
{
- System.out.println("Number of messages received not correct ! -- " + receiveHolder.size());
- result = false;
+ throw new IllegalStateException("Number of messages received not correct ! -- " + receiveHolder.size());
}
String msg = receiveHolder.get(0);
if (!msg.equals(value))
{
- System.out.println("Received message [" + msg + "], but we expect [" + value + "]");
- result = false;
+ throw new IllegalStateException("Received message [" + msg + "], but we expect [" + value + "]");
}
receiveHolder.clear();
}
- private void checkNoMessageReceived()
+ private static void checkNoMessageReceived(ArrayList receiveHolder)
{
if (receiveHolder.size() > 0)
{
- System.out.println("Message received, wrong!");
- result = false;
+ throw new IllegalStateException("Message received, wrong!");
}
receiveHolder.clear();
}
+}
- public class SimpleMessageListener implements MessageListener
+class SimpleMessageListener implements MessageListener
+{
+ ArrayList receiveHolder;
+ Boolean result;
+
+ SimpleMessageListener(ArrayList receiveHolder, Boolean result)
{
- public void onMessage(final Message message)
- {
- try
- {
- System.out.println("Message received: " + ((TextMessage)message).getText());
- receiveHolder.add(((TextMessage)message).getText());
- }
- catch (JMSException e)
- {
- result = false;
- e.printStackTrace();
- }
- }
-
+ this.receiveHolder = receiveHolder;
+ this.result = result;
}
+ public void onMessage(final Message message)
+ {
+ try
+ {
+ System.out.println("Message received: " + ((TextMessage)message).getText());
+ receiveHolder.add(((TextMessage)message).getText());
+ }
+ catch (JMSException e)
+ {
+ result = false;
+ e.printStackTrace();
+ }
+ }
}
diff --git a/examples/jms/xa-heuristic/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/xa-heuristic/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/xa-heuristic/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
diff --git a/examples/jms/xa-heuristic/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/xa-heuristic/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/xa-heuristic/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
diff --git a/examples/jms/xa-heuristic/src/main/resources/activemq/server0/broker.xml b/examples/jms/xa-heuristic/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/xa-heuristic/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/xa-receive/pom.xml b/examples/jms/xa-receive/pom.xml
index 5fa068a6fd..8336c5f9e6 100644
--- a/examples/jms/xa-receive/pom.xml
+++ b/examples/jms/xa-receive/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-commons
${project.version}
@@ -61,9 +61,18 @@ under the License.
create
+
+
+ start
+
+ cli
+
- ${basedir}/target/server0
- ${basedir}/target/classes/activemq/server0
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -72,9 +81,17 @@ under the License.
runClient
- org.apache.activemq.artemis.jms.example.TransactionalExample
+ org.apache.activemq.artemis.jms.example.XAReceiveExample
+
+
+
+ stop
+
+ cli
+
+
- ${basedir}/target/server0
+ stop
diff --git a/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/DummyXid.java b/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java
similarity index 99%
rename from examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/DummyXid.java
rename to examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java
index 05e320fb9e..c8bf9cc834 100644
--- a/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/DummyXid.java
+++ b/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.artemis.common.example;
-
-import javax.transaction.xa.Xid;
+package org.apache.activemq.artemis.jms.example;
import org.apache.activemq.artemis.utils.Base64;
+import javax.transaction.xa.Xid;
+
public class DummyXid implements Xid
{
private static final long serialVersionUID = 407053232840068514L;
diff --git a/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java b/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java
index 2671e54682..6562cea5ca 100644
--- a/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java
+++ b/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java
@@ -29,26 +29,14 @@ import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.nio.charset.StandardCharsets;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-
-// Defined on xa-heuristic example, the maven dependency will take care of that
-import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.utils.UUIDGenerator;
/**
* A simple JMS example showing the usage of XA support in JMS.
*/
-public class XAReceiveExample extends ActiveMQExample
+public class XAReceiveExample
{
- private volatile boolean result = true;
-
- public static void main(final String[] args)
- {
- new XAReceiveExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
XAConnection connection = null;
InitialContext initialContext = null;
@@ -90,8 +78,8 @@ public class XAReceiveExample extends ActiveMQExample
// Step 12. create a transaction
Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.US_ASCII), 1, UUIDGenerator.getInstance()
- .generateStringUUID()
- .getBytes());
+ .generateStringUUID()
+ .getBytes());
// Step 13. Get the JMS XAResource
XAResource xaRes = xaSession.getXAResource();
@@ -120,8 +108,8 @@ public class XAReceiveExample extends ActiveMQExample
// Step 20. Create another transaction
Xid xid2 = new DummyXid("xa-example2".getBytes(), 1, UUIDGenerator.getInstance()
- .generateStringUUID()
- .getBytes());
+ .generateStringUUID()
+ .getBytes());
// Step 21. Start the transaction
xaRes.start(xid2, XAResource.TMNOFLAGS);
@@ -149,10 +137,8 @@ public class XAReceiveExample extends ActiveMQExample
}
else
{
- result = false;
+ throw new IllegalStateException();
}
-
- return result;
}
finally
{
@@ -167,5 +153,4 @@ public class XAReceiveExample extends ActiveMQExample
}
}
}
-
}
diff --git a/examples/jms/xa-receive/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/xa-receive/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/xa-receive/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
diff --git a/examples/jms/xa-receive/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/xa-receive/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/xa-receive/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
diff --git a/examples/jms/xa-receive/src/main/resources/activemq/server0/broker.xml b/examples/jms/xa-receive/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/xa-receive/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/jms/xa-send/pom.xml b/examples/jms/xa-send/pom.xml
index 594bb446af..3038202e98 100644
--- a/examples/jms/xa-send/pom.xml
+++ b/examples/jms/xa-send/pom.xml
@@ -37,8 +37,8 @@ under the License.
- org.apache.activemq.examples.jms
- common
+ org.apache.activemq
+ artemis-commons
${project.version}
@@ -56,18 +56,23 @@ under the License.
org.apache.activemq
artemis-maven-plugin
+
+ create
+
+ create
+
+
start
- start
+ cli
-
-
- data.dir
- ${basedir}/target/
-
-
+ true
+ tcp://localhost:61616
+
+ run
+
@@ -82,8 +87,13 @@ under the License.
stop
- stop
+ cli
+
+
+ stop
+
+
@@ -92,45 +102,10 @@ under the License.
artemis-jms-xa-send-example
${project.version}
-
- org.apache.activemq
- artemis-core-client
- ${project.version}
-
-
- org.apache.activemq
- artemis-server
- ${project.version}
-
-
- org.apache.activemq
- artemis-jms-client
- ${project.version}
-
-
- org.apache.activemq
- artemis-jms-server
- ${project.version}
-
-
- io.netty
- netty-all
- ${netty.version}
-
-
- org.apache.geronimo.specs
- geronimo-jms_2.0_spec
- ${geronimo.jms.2.spec.version}
-
-
- false
- ${basedir}/target/classes/activemq/server0
-
-
diff --git a/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java b/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java
new file mode 100644
index 0000000000..c8bf9cc834
--- /dev/null
+++ b/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/DummyXid.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.jms.example;
+
+import org.apache.activemq.artemis.utils.Base64;
+
+import javax.transaction.xa.Xid;
+
+public class DummyXid implements Xid
+{
+ private static final long serialVersionUID = 407053232840068514L;
+
+ private final byte[] branchQualifier;
+
+ private final int formatId;
+
+ private final byte[] globalTransactionId;
+
+ private int hash;
+
+ private boolean hashCalculated;
+
+ // Static --------------------------------------------------------
+
+ public static String toBase64String(final Xid xid)
+ {
+ return Base64.encodeBytes(DummyXid.toByteArray(xid));
+ }
+
+ private static byte[] toByteArray(final Xid xid)
+ {
+ byte[] branchQualifier = xid.getBranchQualifier();
+ byte[] globalTransactionId = xid.getGlobalTransactionId();
+ int formatId = xid.getFormatId();
+
+ byte[] hashBytes = new byte[branchQualifier.length + globalTransactionId.length + 4];
+ System.arraycopy(branchQualifier, 0, hashBytes, 0, branchQualifier.length);
+ System.arraycopy(globalTransactionId, 0, hashBytes, branchQualifier.length, globalTransactionId.length);
+ byte[] intBytes = new byte[4];
+ for (int i = 0; i < 4; i++)
+ {
+ intBytes[i] = (byte)((formatId >> i * 8) % 0xFF);
+ }
+ System.arraycopy(intBytes, 0, hashBytes, branchQualifier.length + globalTransactionId.length, 4);
+ return hashBytes;
+ }
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * Standard constructor
+ * @param branchQualifier
+ * @param formatId
+ * @param globalTransactionId
+ */
+ public DummyXid(final byte[] branchQualifier, final int formatId, final byte[] globalTransactionId)
+ {
+ this.branchQualifier = branchQualifier;
+ this.formatId = formatId;
+ this.globalTransactionId = globalTransactionId;
+ }
+
+ /**
+ * Copy constructor
+ * @param other
+ */
+ public DummyXid(final Xid other)
+ {
+ branchQualifier = copyBytes(other.getBranchQualifier());
+ formatId = other.getFormatId();
+ globalTransactionId = copyBytes(other.getGlobalTransactionId());
+ }
+
+ // Xid implementation ------------------------------------------------------------------
+
+ public byte[] getBranchQualifier()
+ {
+ return branchQualifier;
+ }
+
+ public int getFormatId()
+ {
+ return formatId;
+ }
+
+ public byte[] getGlobalTransactionId()
+ {
+ return globalTransactionId;
+ }
+
+ // Public -------------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ if (!hashCalculated)
+ {
+ calcHash();
+ }
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (this == other)
+ {
+ return true;
+ }
+ if (!(other instanceof Xid))
+ {
+ return false;
+ }
+ Xid xother = (Xid)other;
+ if (xother.getFormatId() != formatId)
+ {
+ return false;
+ }
+ if (xother.getBranchQualifier().length != branchQualifier.length)
+ {
+ return false;
+ }
+ if (xother.getGlobalTransactionId().length != globalTransactionId.length)
+ {
+ return false;
+ }
+ for (int i = 0; i < branchQualifier.length; i++)
+ {
+ byte[] otherBQ = xother.getBranchQualifier();
+ if (branchQualifier[i] != otherBQ[i])
+ {
+ return false;
+ }
+ }
+ for (int i = 0; i < globalTransactionId.length; i++)
+ {
+ byte[] otherGtx = xother.getGlobalTransactionId();
+ if (globalTransactionId[i] != otherGtx[i])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "XidImpl (" + System.identityHashCode(this) +
+ " bq:" +
+ stringRep(branchQualifier) +
+ " formatID:" +
+ formatId +
+ " gtxid:" +
+ stringRep(globalTransactionId);
+ }
+
+ // Private -------------------------------------------------------------------------------
+
+ private String stringRep(final byte[] bytes)
+ {
+ StringBuilder buff = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++)
+ {
+ byte b = bytes[i];
+
+ buff.append(b);
+
+ if (i != bytes.length - 1)
+ {
+ buff.append('.');
+ }
+ }
+
+ return buff.toString();
+ }
+
+ private void calcHash()
+ {
+ byte[] hashBytes = DummyXid.toByteArray(this);
+ String s = new String(hashBytes);
+ hash = s.hashCode();
+ hashCalculated = true;
+ }
+
+ private byte[] copyBytes(final byte[] other)
+ {
+ byte[] bytes = new byte[other.length];
+
+ System.arraycopy(other, 0, bytes, 0, other.length);
+
+ return bytes;
+ }
+}
diff --git a/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java b/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java
index 447fbc49f0..43d6c21193 100644
--- a/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java
+++ b/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java
@@ -32,28 +32,19 @@ import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.activemq.artemis.common.example.ActiveMQExample;
-import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.utils.UUIDGenerator;
/**
* A simple JMS example showing the usage of XA support in JMS.
*/
-public class XASendExample extends ActiveMQExample
+public class XASendExample
{
- private volatile boolean result = true;
-
- private final ArrayList receiveHolder = new ArrayList();
-
- public static void main(final String[] args)
- {
- new XASendExample().run(args);
- }
-
- @Override
- public boolean runExample() throws Exception
+ public static void main(final String[] args) throws Exception
{
+ AtomicBoolean result = new AtomicBoolean(true);
+ final ArrayList receiveHolder = new ArrayList();
XAConnection connection = null;
InitialContext initialContext = null;
try
@@ -81,7 +72,7 @@ public class XASendExample extends ActiveMQExample
// Step 8. Create a normal Message Consumer
MessageConsumer normalConsumer = normalSession.createConsumer(queue);
- normalConsumer.setMessageListener(new SimpleMessageListener());
+ normalConsumer.setMessageListener(new SimpleMessageListener(receiveHolder, result));
// Step 9. Get the JMS Session
Session session = xaSession.getSession();
@@ -95,8 +86,8 @@ public class XASendExample extends ActiveMQExample
// Step 12. create a transaction
Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.UTF_8), 1, UUIDGenerator.getInstance()
- .generateStringUUID()
- .getBytes());
+ .generateStringUUID()
+ .getBytes());
// Step 13. Get the JMS XAResource
XAResource xaRes = xaSession.getXAResource();
@@ -111,7 +102,7 @@ public class XASendExample extends ActiveMQExample
Thread.sleep(2000);
// Step 16. Check the result, it should receive none!
- checkNoMessageReceived();
+ checkNoMessageReceived(receiveHolder);
// Step 17. Stop the work
xaRes.end(xid1, XAResource.TMSUCCESS);
@@ -123,12 +114,12 @@ public class XASendExample extends ActiveMQExample
xaRes.rollback(xid1);
// Step 20. No messages should be received!
- checkNoMessageReceived();
+ checkNoMessageReceived(receiveHolder);
// Step 21. Create another transaction
Xid xid2 = new DummyXid("xa-example2".getBytes(), 1, UUIDGenerator.getInstance()
- .generateStringUUID()
- .getBytes());
+ .generateStringUUID()
+ .getBytes());
// Step 22. Start the transaction
xaRes.start(xid2, XAResource.TMNOFLAGS);
@@ -144,7 +135,7 @@ public class XASendExample extends ActiveMQExample
xaRes.prepare(xid2);
// Step 26. No messages should be received at this moment
- checkNoMessageReceived();
+ checkNoMessageReceived(receiveHolder);
// Step 27. Commit!
xaRes.commit(xid2, false);
@@ -152,9 +143,10 @@ public class XASendExample extends ActiveMQExample
Thread.sleep(2000);
// Step 28. Check the result, all message received
- checkAllMessageReceived();
+ checkAllMessageReceived(receiveHolder);
- return result;
+ if (!result.get())
+ throw new IllegalStateException();
}
finally
{
@@ -170,42 +162,47 @@ public class XASendExample extends ActiveMQExample
}
}
- private void checkAllMessageReceived()
+ private static void checkAllMessageReceived(ArrayList receiveHolder)
{
if (receiveHolder.size() != 2)
{
- System.out.println("Number of messages received not correct ! -- " + receiveHolder.size());
- result = false;
+ throw new IllegalStateException("Number of messages received not correct ! -- " + receiveHolder.size());
}
receiveHolder.clear();
}
- private void checkNoMessageReceived()
+ private static void checkNoMessageReceived(ArrayList receiveHolder)
{
if (receiveHolder.size() > 0)
{
- System.out.println("Message received, wrong!");
- result = false;
+ throw new IllegalStateException("Message received, wrong!");
}
receiveHolder.clear();
}
+}
- public class SimpleMessageListener implements MessageListener
+class SimpleMessageListener implements MessageListener
+{
+ ArrayList receiveHolder;
+ AtomicBoolean result;
+
+ public SimpleMessageListener(ArrayList receiveHolder, AtomicBoolean result)
{
- public void onMessage(final Message message)
- {
- try
- {
- System.out.println("Message received: " + message);
- receiveHolder.add(((TextMessage)message).getText());
- }
- catch (JMSException e)
- {
- result = false;
- e.printStackTrace();
- }
- }
-
+ this.receiveHolder = receiveHolder;
+ this.result = result;
}
+ public void onMessage(final Message message)
+ {
+ try
+ {
+ System.out.println("Message received: " + message);
+ receiveHolder.add(((TextMessage)message).getText());
+ }
+ catch (JMSException e)
+ {
+ result.set(false);
+ e.printStackTrace();
+ }
+ }
}
diff --git a/examples/jms/xa-send/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/xa-send/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/xa-send/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
diff --git a/examples/jms/xa-send/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/xa-send/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/jms/xa-send/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
diff --git a/examples/jms/xa-send/src/main/resources/activemq/server0/broker.xml b/examples/jms/xa-send/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 7690094861..0000000000
--- a/examples/jms/xa-send/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- ${data.dir}/server0/data/messaging/bindings
-
- ${data.dir}/server0/data/messaging/journal
-
- ${data.dir}/server0/data/messaging/largemessages
-
- ${data.dir}/server0/data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-