From b3af4bb77751996419868be9784ba73f1c7e72fe Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 12 May 2015 17:59:02 -0400 Subject: [PATCH] ARTEMIS-178 Refactor examples to use CLI This is changing the examples to run the real servers. The maven plugin should be an automation of the CLI Where we run real servers instead of any embedded framework Going forward we will need to remove the common examples. Failover examples will be able to use Process Builders --- .../apache/activemq/artemis/cli/Artemis.java | 6 + .../activemq/artemis/cli/commands/Create.java | 29 +- .../activemq/artemis/cli/commands/Run.java | 2 + .../artemis/cli/process/ProcessBuilder.java | 192 ++++++++++ .../artemis/cli/process/package-info.java | 7 +- .../cli/commands/etc/replicated-settings.txt | 2 +- .../commands/etc/shared-store-settings.txt | 2 +- .../src/main/resources/bin/artemis | 2 +- artemis-maven-plugin/pom.xml | 20 ++ .../artemis/maven/ActiveMQClientPlugin.java | 19 +- .../artemis/maven/ActiveMQCreatePlugin.java | 331 ++++++++++++++++++ .../artemis/maven/ActiveMQStartPlugin.java | 230 ------------ .../artemis/maven/ActiveMQStopPlugin.java | 76 ---- .../artemis/maven/ArtemisCLIPlugin.java | 172 +++++++++ .../artemis/maven/InVMNodeManagerServer.java | 75 ---- .../artemis/maven/LibInstallPlugin.java | 147 ++++++++ .../activemq/artemis/maven/PluginUtil.java | 50 --- .../artemis/maven/TestClusterManager.java | 52 --- .../activemq/artemis/maven/TestNode.java | 49 --- .../artemis/server/ActiveMQBootstrap.java | 270 -------------- .../server/SpawnedActiveMQBootstrap.java | 38 -- .../artemis/server/SpawnedVMSupport.java | 252 ------------- examples/jms/aerogear/pom.xml | 139 ++++---- .../artemis/jms/example/AerogearExample.java | 16 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../resources/activemq/server0/broker.xml | 10 +- .../jms/application-layer-failover/pom.xml | 77 +--- .../ApplicationLayerFailoverExample.java | 6 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../resources/activemq/server0/broker.xml | 53 --- .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - .../resources/activemq/server1/broker.xml | 56 --- examples/jms/bridge/pom.xml | 65 +--- .../artemis/jms/example/BridgeExample.java | 3 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - examples/jms/browser/pom.xml | 53 +-- .../jms/example/QueueBrowserExample.java | 3 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../resources/activemq/server0/broker.xml | 61 ---- examples/jms/client-kickoff/pom.xml | 72 +--- .../jms/example/ClientKickoffExample.java | 5 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../jms/client-side-failoverlistener/pom.xml | 107 +----- .../ClientSideFailoverListerExample.java | 14 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../resources/activemq/server0/broker.xml | 92 ----- .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - .../resources/activemq/server1/broker.xml | 93 ----- .../jms/client-side-load-balancing/pom.xml | 128 ++----- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../resources/activemq/server0/broker.xml | 92 ----- .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - .../resources/activemq/server1/broker.xml | 89 ----- .../activemq/server2/artemis-roles.properties | 17 - .../activemq/server2/artemis-users.properties | 17 - .../resources/activemq/server2/broker.xml | 87 ----- .../clustered-durable-subscription/pom.xml | 95 +---- .../ClusteredDurableSubscriptionExample.java | 7 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - examples/jms/clustered-grouping/pom.xml | 133 +------ .../jms/example/ClusteredGroupingExample.java | 9 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../resources/activemq/server0/broker.xml | 9 +- .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - .../resources/activemq/server1/broker.xml | 9 +- .../activemq/server2/artemis-roles.properties | 17 - .../activemq/server2/artemis-users.properties | 17 - .../resources/activemq/server2/broker.xml | 9 +- examples/jms/clustered-jgroups/pom.xml | 95 +---- .../jms/example/ClusteredJgroupsExample.java | 7 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../server0/test-jgroups-file_ping.xml | 3 +- .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - .../server1/test-jgroups-file_ping.xml | 3 +- examples/jms/clustered-queue/pom.xml | 83 +---- .../jms/example/ClusteredQueueExample.java | 7 +- examples/jms/clustered-standalone/pom.xml | 112 +----- .../example/ClusteredStandaloneExample.java | 11 +- .../jms/clustered-static-discovery/pom.xml | 123 ++----- .../example/StaticClusteredQueueExample.java | 5 +- examples/jms/clustered-static-oneway/pom.xml | 101 +----- .../example/ClusterStaticOnewayExample.java | 5 +- examples/jms/clustered-topic/pom.xml | 102 +----- .../jms/example/ClusteredTopicExample.java | 7 +- .../jms/colocated-failover-scale-down/pom.xml | 88 +---- .../ColocatedFailoverScaleDownExample.java | 11 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- examples/jms/colocated-failover/pom.xml | 88 +---- .../jms/example/ColocatedFailoverExample.java | 11 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- examples/jms/common/pom.xml | 5 + .../common/example/ActiveMQExample.java | 246 +++++++------ .../artemis/common/example/ExampleUtil.java | 122 +++++++ examples/jms/consumer-rate-limit/pom.xml | 54 +-- examples/jms/dead-letter/pom.xml | 54 +-- examples/jms/delayed-redelivery/pom.xml | 56 +-- examples/jms/divert/pom.xml | 82 +---- .../artemis/jms/example/DivertExample.java | 7 +- examples/jms/durable-subscription/pom.xml | 54 +-- examples/jms/embedded-simple/pom.xml | 44 --- .../artemis/jms/example/EmbeddedExample.java | 11 +- examples/jms/embedded/pom.xml | 44 --- .../artemis/jms/example/EmbeddedExample.java | 7 +- examples/jms/expiry/pom.xml | 54 +-- examples/jms/ha-policy-autobackup/pom.xml | 88 +---- .../example/HAPolicyAutoBackupExample.java | 28 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- examples/jms/http-transport/pom.xml | 60 +--- .../resources/activemq/server0/broker.xml | 2 + .../instantiate-connection-factory/pom.xml | 54 +-- .../InstantiateConnectionFactoryExample.java | 7 +- .../resources/activemq/server0/broker.xml | 2 +- examples/jms/interceptor/pom.xml | 56 +-- examples/jms/jms-auto-closeable/pom.xml | 55 +-- examples/jms/jms-bridge/pom.xml | 82 +---- .../artemis/jms/example/JMSBridgeExample.java | 34 +- .../resources/activemq/server1/broker.xml | 3 +- examples/jms/jms-completion-listener/pom.xml | 57 +-- examples/jms/jms-context/pom.xml | 55 +-- examples/jms/jms-shared-consumer/pom.xml | 54 +-- .../jms/example/JMSSharedConsumerExample.java | 5 +- examples/jms/jmx/pom.xml | 77 +--- examples/jms/large-message/pom.xml | 63 +--- .../jms/example/LargeMessageExample.java | 15 +- examples/jms/last-value-queue/pom.xml | 57 +-- examples/jms/management-notifications/pom.xml | 57 +-- examples/jms/management/pom.xml | 55 +-- examples/jms/message-counters/pom.xml | 77 +--- examples/jms/message-group/pom.xml | 57 +-- examples/jms/message-group2/pom.xml | 55 +-- examples/jms/message-priority/pom.xml | 57 +-- .../jms/multiple-failover-failback/pom.xml | 132 +------ .../MultipleFailoverFailbackExample.java | 16 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- .../resources/activemq/server2/broker.xml | 8 +- examples/jms/multiple-failover/pom.xml | 130 +------ .../jms/example/MultipleFailoverExample.java | 19 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- .../resources/activemq/server2/broker.xml | 8 +- examples/jms/no-consumer-buffering/pom.xml | 55 +-- examples/jms/non-transaction-failover/pom.xml | 98 +----- .../NonTransactionFailoverExample.java | 13 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- examples/jms/openwire/pom.xml | 60 +--- .../resources/activemq/server0/broker.xml | 4 +- examples/jms/paging/pom.xml | 55 +-- examples/jms/perf/pom.xml | 90 ++--- .../activemq/artemis/jms/example/Server.java | 17 +- .../perf/src/main/resources/perf.properties | 6 +- examples/jms/pre-acknowledge/pom.xml | 54 +-- examples/jms/producer-rate-limit/pom.xml | 55 +-- examples/jms/proton-cpp/pom.xml | 61 +--- .../artemis/jms/example/ProtonCPPExample.java | 3 - examples/jms/proton-j/pom.xml | 59 +--- .../resources/activemq/server0/broker.xml | 1 + examples/jms/proton-ruby/pom.xml | 52 +-- examples/jms/proton-ruby/readme.html | 3 +- .../jms/queue-message-redistribution/pom.xml | 102 +----- .../QueueMessageRedistributionExample.java | 7 +- .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../activemq/server1/artemis-roles.properties | 17 - .../activemq/server1/artemis-users.properties | 17 - examples/jms/queue-requestor/pom.xml | 55 +-- examples/jms/queue-selector/pom.xml | 55 +-- examples/jms/queue/pom.xml | 56 +-- examples/jms/queue/readme.html | 1 + .../activemq/server0/artemis-roles.properties | 17 - .../activemq/server0/artemis-users.properties | 17 - .../resources/activemq/server0/broker.xml | 60 ---- examples/jms/reattach-node/pom.xml | 64 +--- .../jms/replicated-failback-static/pom.xml | 104 +----- examples/jms/replicated-failback/pom.xml | 104 +----- .../example/ReplicatedFailbackExample.java | 6 + .../resources/activemq/server0/broker.xml | 10 +- .../resources/activemq/server1/broker.xml | 10 +- .../jms/replicated-multiple-failover/pom.xml | 133 +------ .../replicated-transaction-failover/pom.xml | 104 +----- examples/jms/request-reply/pom.xml | 55 +-- examples/jms/scale-down/pom.xml | 90 +---- .../artemis/jms/example/ScaleDownExample.java | 8 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- examples/jms/scheduled-message/pom.xml | 55 +-- examples/jms/security/pom.xml | 55 +-- examples/jms/send-acknowledgements/pom.xml | 55 +-- examples/jms/spring-integration/pom.xml | 37 +- examples/jms/ssl-enabled/pom.xml | 55 +-- examples/jms/static-selector-jms/pom.xml | 54 +-- examples/jms/static-selector/pom.xml | 55 +-- examples/jms/stomp-websockets/pom.xml | 68 +--- examples/jms/stomp/pom.xml | 60 +--- examples/jms/stomp1.1/pom.xml | 60 +--- examples/jms/stomp1.2/pom.xml | 60 +--- examples/jms/stop-server-failover/pom.xml | 104 +----- examples/jms/symmetric-cluster/pom.xml | 225 ++---------- .../jms/example/SymmetricClusterExample.java | 12 +- examples/jms/temp-queue/pom.xml | 55 +-- examples/jms/topic-hierarchies/pom.xml | 55 +-- examples/jms/topic-selector-example1/pom.xml | 55 +-- examples/jms/topic-selector-example2/pom.xml | 55 +-- examples/jms/topic/pom.xml | 54 +-- examples/jms/transaction-failover/pom.xml | 104 +----- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server1/broker.xml | 8 +- examples/jms/transactional/pom.xml | 55 +-- examples/jms/xa-heuristic/pom.xml | 76 +--- .../jms/example/XAHeuristicExample.java | 12 +- examples/jms/xa-receive/pom.xml | 58 +-- .../artemis/jms/example/XAReceiveExample.java | 10 +- .../artemis/jms/example/XASendExample.java | 10 +- examples/soak/normal/README | 21 +- examples/soak/normal/pom.xml | 135 +++---- examples/soak/normal/server0/broker.xml | 5 +- .../jms/soak/example/SoakReceiver.java | 31 +- .../artemis/jms/soak/example/SoakSender.java | 27 +- .../normal/src/main/resources/jndi.properties | 20 ++ 242 files changed, 2482 insertions(+), 8739 deletions(-) create mode 100644 artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java rename artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClient.java => artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/package-info.java (86%) create mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQCreatePlugin.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStartPlugin.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStopPlugin.java create mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/InVMNodeManagerServer.java create mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/LibInstallPlugin.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/PluginUtil.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManager.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestNode.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/ActiveMQBootstrap.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedActiveMQBootstrap.java delete mode 100644 artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedVMSupport.java delete mode 100644 examples/jms/aerogear/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/aerogear/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/application-layer-failover/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/application-layer-failover/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/application-layer-failover/src/main/resources/activemq/server0/broker.xml delete mode 100644 examples/jms/application-layer-failover/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/application-layer-failover/src/main/resources/activemq/server1/artemis-users.properties delete mode 100644 examples/jms/application-layer-failover/src/main/resources/activemq/server1/broker.xml delete mode 100644 examples/jms/bridge/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/bridge/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/bridge/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/bridge/src/main/resources/activemq/server1/artemis-users.properties delete mode 100644 examples/jms/browser/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/browser/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/browser/src/main/resources/activemq/server0/broker.xml delete mode 100644 examples/jms/client-kickoff/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/client-kickoff/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/broker.xml delete mode 100644 examples/jms/client-side-failoverlistener/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/client-side-failoverlistener/src/main/resources/activemq/server1/artemis-users.properties delete mode 100644 examples/jms/client-side-failoverlistener/src/main/resources/activemq/server1/broker.xml delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/broker.xml delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/artemis-users.properties delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/broker.xml delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/artemis-roles.properties delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/artemis-users.properties delete mode 100644 examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/broker.xml delete mode 100644 examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/artemis-users.properties delete mode 100644 examples/jms/clustered-grouping/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/clustered-grouping/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/clustered-grouping/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/clustered-grouping/src/main/resources/activemq/server1/artemis-users.properties delete mode 100644 examples/jms/clustered-grouping/src/main/resources/activemq/server2/artemis-roles.properties delete mode 100644 examples/jms/clustered-grouping/src/main/resources/activemq/server2/artemis-users.properties delete mode 100644 examples/jms/clustered-jgroups/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/clustered-jgroups/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/clustered-jgroups/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/clustered-jgroups/src/main/resources/activemq/server1/artemis-users.properties create mode 100644 examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ExampleUtil.java rename artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManagerMBean.java => examples/jms/perf/src/main/java/org/apache/activemq/artemis/jms/example/Server.java (64%) delete mode 100644 examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/artemis-roles.properties delete mode 100644 examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/artemis-users.properties delete mode 100644 examples/jms/queue/src/main/resources/activemq/server0/artemis-roles.properties delete mode 100644 examples/jms/queue/src/main/resources/activemq/server0/artemis-users.properties delete mode 100644 examples/jms/queue/src/main/resources/activemq/server0/broker.xml create mode 100644 examples/soak/normal/src/main/resources/jndi.properties diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java index 1b09ea46df..edcdce0b74 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.cli; import java.io.File; import java.io.InputStream; import java.io.OutputStream; +import java.util.List; import io.airlift.airline.Cli; import org.apache.activemq.artemis.cli.commands.Action; @@ -70,6 +71,11 @@ public class Artemis return execute(null, null, args); } + public static Object execute(File artemisHome, File artemisInstance, List args) throws Exception + { + return execute(artemisHome, artemisInstance, (String[]) args.toArray(new String[args.size()])); + } + public static Object execute(File artemisHome, File artemisInstance, String... args) throws Exception { Action action = builder(artemisInstance).build().parse(args); diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index b349ad18d5..580b4110c7 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -118,6 +118,9 @@ public class Create extends InputAbstract @Option(name = "--shared-store", description = "Enable broker shared store") boolean sharedStore = false; + @Option(name = "--slave", description = "Valid for shared store or replication: this is a slave server?") + boolean slave; + @Option(name = "--cluster-user", description = "The cluster user to use for clustering. (Default: input)") String clusterUser = null; @@ -411,6 +414,26 @@ public class Create extends InputAbstract this.role = role; } + public boolean isSlave() + { + return slave; + } + + public void setSlave(boolean slave) + { + this.slave = slave; + } + + public Boolean getAllowAnonymous() + { + return allowAnonymous; + } + + public void setAllowAnonymous(Boolean allowAnonymous) + { + this.allowAnonymous = allowAnonymous; + } + @Override public Object execute(ActionContext context) throws Exception { @@ -469,10 +492,12 @@ public class Create extends InputAbstract HashMap filters = new HashMap(); + filters.put("${master-slave}", isSlave() ? "slave" : "master"); + if (replicated) { clustered = true; - filters.put("${replicated.settings}", readTextFile(ETC_REPLICATED_SETTINGS_TXT)); + filters.put("${replicated.settings}", applyFilters(readTextFile(ETC_REPLICATED_SETTINGS_TXT), filters)); } else { @@ -482,7 +507,7 @@ public class Create extends InputAbstract if (sharedStore) { clustered = true; - filters.put("${shared-store.settings}", readTextFile(ETC_SHARED_STORE_SETTINGS_TXT)); + filters.put("${shared-store.settings}", applyFilters(readTextFile(ETC_SHARED_STORE_SETTINGS_TXT), filters)); } else { diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java index e9b77054c4..67824ce757 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java @@ -164,6 +164,8 @@ public class Run extends Configurable } finally { + System.out.println("Server stopped!"); + System.out.flush(); latchRunning.countDown(); if (!embedded) { diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java new file mode 100644 index 0000000000..05d09d5335 --- /dev/null +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java @@ -0,0 +1,192 @@ +/* + * 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.cli.process; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.apache.activemq.artemis.utils.ConcurrentHashSet; + +public class ProcessBuilder +{ + static ConcurrentHashSet processes = new ConcurrentHashSet<>(); + + static + { + Runtime.getRuntime().addShutdownHook(new Thread() + { + public void run() + { + for (Process p : processes) + { + if (p.isAlive()) + { + p.destroy(); + } + } + } + }); + } + + + /** + * it will lookup for process that are dead already, eliminating leaks. + */ + public static void cleanupProcess() + { + for (Process p: processes) + { + if (!p.isAlive()) + { + processes.remove(p); + } + } + } + + + + /** + * * + * @param logname the prefix for log output + * @param location The location where this command is being executed from + * @param hook it will finish the process upon shutdown of the VM + * @param args The arguments being passwed to the the CLI tool + * @return + * @throws Exception + */ + public static Process build(String logname, File location, boolean hook, String... args) throws Exception + { + boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().trim().startsWith("win"); + + String[] newArgs; + if (IS_WINDOWS) + { + newArgs = rebuildArgs(args, "cmd", "/c", "artemis.cmd"); + } + else + { + newArgs = rebuildArgs(args, "./artemis"); + } + + java.lang.ProcessBuilder builder = new java.lang.ProcessBuilder(newArgs); + + builder.directory(new File(location, "bin")); + + Process process = builder.start(); + + ProcessLogger outputLogger = new ProcessLogger(true, + process.getInputStream(), + logname + "::Out", + false); + outputLogger.start(); + + // Adding a reader to System.err, so the VM won't hang on a System.err.println as identified on this forum thread: + ProcessLogger errorLogger = new ProcessLogger(true, + process.getErrorStream(), + logname + "::Err", + true); + errorLogger.start(); + + processes.add(process); + + cleanupProcess(); + + return process; + } + + public static String[] rebuildArgs(String[] args, String ... prefixArgs) + { + String[] resultArgs = new String[args.length + prefixArgs.length]; + + int i = 0; + + for (String arg: prefixArgs) + { + resultArgs[i++] = arg; + } + + for (String arg: args) + { + resultArgs[i++] = arg; + } + + return resultArgs; + } + + + /** + * Redirect the input stream to a logger (as debug logs) + */ + static class ProcessLogger extends Thread + { + private final InputStream is; + + private final String logName; + + private final boolean print; + + private final boolean sendToErr; + + boolean failed = false; + + ProcessLogger(final boolean print, + final InputStream is, + final String logName, + final boolean sendToErr) throws ClassNotFoundException + { + this.is = is; + this.print = print; + this.logName = logName; + this.sendToErr = sendToErr; + setDaemon(false); + } + + @Override + public void run() + { + try + { + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + String line; + while ((line = br.readLine()) != null) + { + if (print) + { + if (sendToErr) + { + System.err.println(logName + " err:" + line); + } + else + { + System.out.println(logName + " out:" + line); + } + } + } + } + catch (IOException e) + { + // ok, stream closed + } + + } + } + +} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClient.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/package-info.java similarity index 86% rename from artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClient.java rename to artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/package-info.java index 4b7de95041..d902bbd290 100644 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClient.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/package-info.java @@ -14,9 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.maven; -public interface ActiveMQClient -{ - void run(); -} +/** Contains useful classes for spawning process from client classes */ +package org.apache.activemq.artemis.cli.process; diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt index db9faa09af..17a2bc372c 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt @@ -1,6 +1,6 @@ - + <${master-slave}/> diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt index 5901938b90..750dbc1738 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt @@ -1,6 +1,6 @@ - + <${master-slave}/> diff --git a/artemis-distribution/src/main/resources/bin/artemis b/artemis-distribution/src/main/resources/bin/artemis index a91cf5c1ef..296fb298db 100755 --- a/artemis-distribution/src/main/resources/bin/artemis +++ b/artemis-distribution/src/main/resources/bin/artemis @@ -105,4 +105,4 @@ exec "$JAVACMD" $JAVA_ARGS $ARTEMIS_CLUSTER_PROPS \ -Dartemis.home="$ARTEMIS_HOME" \ -Djava.library.path="$ARTEMIS_HOME/bin/lib/linux-i686:$ARTEMIS_HOME/bin/lib/linux-x86_64" \ $DEBUG_ARGS \ - org.apache.activemq.artemis.boot.Artemis $@ + org.apache.activemq.artemis.boot.Artemis "$@" diff --git a/artemis-maven-plugin/pom.xml b/artemis-maven-plugin/pom.xml index 9d086ad8ed..960a46e43c 100644 --- a/artemis-maven-plugin/pom.xml +++ b/artemis-maven-plugin/pom.xml @@ -42,6 +42,16 @@ maven-dependency-plugin 2.0 + + org.eclipse.aether + aether-api + 1.0.2.v20150114 + + + org.eclipse.aether + aether-util + 1.0.2.v20150114 + org.apache.activemq artemis-server @@ -52,6 +62,16 @@ artemis-jms-server ${project.version} + + org.apache.activemq + artemis-boot + ${project.version} + + + org.apache.activemq + artemis-cli + ${project.version} + io.netty netty-all diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClientPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClientPlugin.java index 90a6112d0a..c269e4f691 100644 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClientPlugin.java +++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQClientPlugin.java @@ -16,30 +16,27 @@ */ package org.apache.activemq.artemis.maven; -import java.lang.reflect.Method; -import java.util.Properties; - import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +import java.lang.reflect.Method; +import java.util.Properties; /** - * Allows a Java Client to be run which must hve a static main(String[] args) method + * Allows a Java Client to be run which must hve a static main(String[] args) method */ @Mojo(name = "runClient", defaultPhase = LifecyclePhase.VERIFY) public class ActiveMQClientPlugin extends AbstractMojo { - /** - * @parameter - */ + @Parameter String clientClass; - /** - * @parameter - */ + @Parameter String[] args; /** @@ -61,7 +58,7 @@ public class ActiveMQClientPlugin extends AbstractMojo } catch (Exception e) { - e.printStackTrace(); + getLog().error(e); throw new MojoFailureException(e.getMessage()); } } diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQCreatePlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQCreatePlugin.java new file mode 100644 index 0000000000..5fca4a3037 --- /dev/null +++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQCreatePlugin.java @@ -0,0 +1,331 @@ +/** + * 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.maven; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.activemq.artemis.cli.Artemis; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; + +@Mojo(name = "create", defaultPhase = LifecyclePhase.VERIFY) +public class ActiveMQCreatePlugin extends AbstractMojo + +{ + + @Parameter + String name; + + /** + * The plugin descriptor + */ + private PluginDescriptor descriptor; + + @Parameter(defaultValue = "${basedir}/target/classes/activemq/server0", required = true) + private File configuration; + + @Parameter(defaultValue = "${activemq.basedir}", required = true) + private File home; + + @Parameter(defaultValue = "${activemq.basedir}/artemis-distribution/target/apache-artemis-${project.version}-bin/apache-artemis-${project.version}/", required = true) + private File alternateHome; + + @Parameter(defaultValue = "${basedir}/target/server0", required = true) + private File instance; + + @Parameter(defaultValue = "true") + private boolean noWeb; + + @Parameter(defaultValue = "guest") + private String user; + + @Parameter(defaultValue = "guest") + private String password; + + @Parameter(defaultValue = "guest") + private String role; + + @Parameter(defaultValue = "") + private String javaOptions = ""; + + @Parameter(defaultValue = "0") + private int portOffset = 0; + + @Parameter(defaultValue = "true") + private boolean allowAnonymous; + + @Parameter(defaultValue = "false") + private boolean replicated; + + @Parameter(defaultValue = "false") + private boolean sharedStore; + + @Parameter(defaultValue = "true") + private boolean clustered; + + @Parameter(defaultValue = "false") + private boolean slave; + + @Parameter(defaultValue = "../data") + String dataFolder; + + @Component + private RepositorySystem repositorySystem; + + @Parameter(defaultValue = "${repositorySystemSession}") + private RepositorySystemSession repoSession; + + @Parameter(defaultValue = "${project.remoteProjectRepositories}") + private List remoteRepos; + + + @Parameter + private String[] libList; + + @Parameter(defaultValue = "${localRepository}") + private org.apache.maven.artifact.repository.ArtifactRepository localRepository; + + /** + * Validate if the directory is a artemis.home * + * + * @param path + * @return + */ + private boolean lookupHome(Path path) + { + + if (path == null) + { + return false; + } + + Path binFolder = path.resolve("bin"); + + if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS)) + { + return false; + } + + Path artemisScript = binFolder.resolve("artemis"); + + + return artemisScript != null && Files.exists(artemisScript, LinkOption.NOFOLLOW_LINKS); + + + } + + private void add(List list, String ... str) + { + for (String s: str) + { + list.add(s); + } + } + + public void execute() throws MojoExecutionException, MojoFailureException + { + getLog().info("Local " + localRepository); + MavenProject project = (MavenProject) getPluginContext().get("project"); + + + if (!lookupHome(home.toPath())) + { + if (lookupHome(alternateHome.toPath())) + { + home = alternateHome; + } + else + { + getLog().error("********************************************************************************************"); + getLog().error("Could not locate suitable Artemis.home on either " + home + " or " + alternateHome); + getLog().error("Use the binary distribution or build the distribution before running the examples"); + getLog().error("********************************************************************************************"); + + throw new MojoExecutionException("Couldn't find artemis.home"); + } + } + + + Map properties = getPluginContext(); + + Set entries = properties.entrySet(); + + getLog().info("Entries.size " + entries.size()); + for (Map.Entry entry : entries) + { + getLog().info("... key=" + entry.getKey() + " = " + entry.getValue()); + } + + ArrayList listCommands = new ArrayList<>(); + add(listCommands, "create", "--allow-anonymous", "--silent-input", "--force", "--no-web", "--user", user, "--password", password, + "--role", role, + "--port-offset", "" + portOffset, + "--data", dataFolder); + + if (allowAnonymous) + { + add(listCommands, "--allow-anonymous"); + } + else + { + add(listCommands, "--require-login"); + } + + if (!javaOptions.isEmpty()) + { + add(listCommands, "--java-options", javaOptions); + } + + if (slave) + { + add(listCommands, "--slave"); + } + + if (replicated) + { + add(listCommands, "--replicated"); + } + + if (replicated) + { + add(listCommands, "--shared-store"); + } + + if (replicated) + { + add(listCommands, "--shared-store"); + } + + if (clustered) + { + add(listCommands, "--clustered"); + } + + add(listCommands, "--verbose"); + + add(listCommands, instance.getAbsolutePath()); + + getLog().info("************************************************"); + getLog().info("Calling create server at " + instance + " home= " + home); + + try + { + Artemis.execute(home, null, listCommands); + + String[] list = configuration.list(); + + if (list != null) + { + getLog().debug("************************************************"); + getLog().debug("Replacing configuration files:"); + + for (String file : configuration.list()) + { + Path target = instance.toPath().resolve("etc").resolve(file); + getLog().debug("Replacing " + file + " into " + target); + + + Files.copy(configuration.toPath().resolve(file), target, StandardCopyOption.REPLACE_EXISTING); + } + } + + File projectLib = project.getArtifact().getFile(); + copyToLib(projectLib); + + if (libList != null) + { + for (int i = 0; i < libList.length; i++) + { + String[] splitString = libList[i].split(":"); + + getLog().debug("********************" + splitString[0] + "/" + splitString[1] + "/" + splitString[2]); + + Artifact artifact; + try + { + artifact = new DefaultArtifact( libList[i] ); + } + catch ( IllegalArgumentException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + + ArtifactRequest request = new ArtifactRequest(); + request.setArtifact( artifact ); + request.setRepositories( remoteRepos ); + + getLog().debug("Resolving artifact " + artifact + " from " + remoteRepos); + + ArtifactResult result; + try + { + result = repositorySystem.resolveArtifact( repoSession, request ); + } + catch ( ArtifactResolutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + + File artifactFile = result.getArtifact().getFile(); + + getLog().debug("Artifact:: " + artifact + " file = " + artifactFile); + + copyToLib(artifactFile); + + } + } + + } + catch (Exception e) + { + getLog().error(e); + throw new MojoFailureException(e.getMessage()); + } + } + + private void copyToLib(File projectLib) throws IOException + { + Path target = instance.toPath().resolve("lib").resolve(projectLib.getName()); + target.toFile().mkdirs(); + getLog().debug("Copying " + projectLib.getName() + " as " + target.toFile().getAbsolutePath()); + Files.copy(projectLib.toPath(), target, StandardCopyOption.REPLACE_EXISTING); + } +} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStartPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStartPlugin.java deleted file mode 100644 index 6a7ca6427a..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStartPlugin.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.maven; - -import javax.management.MBeanServer; -import javax.management.ObjectName; -import java.io.File; -import java.lang.management.ManagementFactory; -import java.util.Arrays; -import java.util.Properties; - -import org.apache.activemq.artemis.server.ActiveMQBootstrap; -import org.apache.activemq.artemis.server.SpawnedActiveMQBootstrap; -import org.apache.activemq.artemis.server.SpawnedVMSupport; -import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.codehaus.classworlds.ClassRealm; -import org.codehaus.classworlds.ClassWorld; - -@Mojo(name = "start", defaultPhase = LifecyclePhase.VERIFY) -public class ActiveMQStartPlugin extends AbstractMojo - -{ - static final String SKIPBROKERSTART = "skipBrokerStart"; - - /** - * The plugin descriptor - */ - private PluginDescriptor descriptor; - - - /** - * @parameter default-value=false - */ - private Boolean waitOnStart; - - /** - * @parameter - */ - private String configurationDir; - - /** - * @parameter - */ - private String nodeId; - - /** - * @parameter default-value=false; - */ - private Boolean fork; - - /** - * @parameter default-value=false - */ - private Boolean debug; - - /** - * @parameter - */ - private Properties systemProperties; - - /** - * @parameter default-value=STARTED:: - */ - private String serverStartString; - - /** - * @parameter - */ - private ActiveMQSecurityManager securityManager; - - /** - * registers a TestClusterMBean for test clients to use. - */ - private boolean testClusterManager; - - public void execute() throws MojoExecutionException, MojoFailureException - { - String property = System.getProperty(SKIPBROKERSTART); - if (property != null) - { - getLog().info("skipping Broker Start"); - return; - } - if (testClusterManager) - { - try - { - createClusterManagerMBean(); - } - catch (Exception e) - { - throw new MojoExecutionException("Failed to create cluster manager mbean", e); - } - } - - if (systemProperties != null && !systemProperties.isEmpty()) - { - System.getProperties() - .putAll(systemProperties); - } - - String workingPath = new File(".").getAbsolutePath(); - - try - { - registerNode(nodeId, workingPath, configurationDir); - } - catch (Exception e1) - { - throw new MojoExecutionException("Failed to create cluster manager mbean", e1); - } - - if (fork) - { - try - { - PluginDescriptor pd = (PluginDescriptor) getPluginContext().get("pluginDescriptor"); - final Process p = SpawnedVMSupport.spawnVM(pd.getArtifacts(), - "ActiveMQServer_" + (nodeId != null ? nodeId : ""), - SpawnedActiveMQBootstrap.class.getName(), - systemProperties, - true, - serverStartString, - "FAILED::", - ".", - configurationDir, - debug, - configurationDir, - "" + waitOnStart, - nodeId); - Runtime.getRuntime().addShutdownHook(new Thread() - { - @Override - public void run() - { - //just to be on the safe side - p.destroy(); - } - }); - if (waitOnStart) - { - p.waitFor(); - } - } - catch (Throwable e) - { - e.printStackTrace(); - throw new MojoExecutionException(e.getMessage()); - } - } - else - { - ActiveMQBootstrap bootstrap = new ActiveMQBootstrap(configurationDir, waitOnStart, nodeId, securityManager); - if (configurationDir != null) - { - extendPluginClasspath(configurationDir); - } - try - { - bootstrap.execute(); - } - catch (Exception e) - { - throw new MojoExecutionException(e.getMessage(), e); - } - } - } - - private void registerNode(String nodeId, String workingPath, - String hornetqConfigurationDir) throws Exception - { - TestClusterManagerMBean control = PluginUtil.getTestClusterManager(); - if (control != null) - { - control.registerNode(nodeId, workingPath, hornetqConfigurationDir); - } - } - - private void createClusterManagerMBean() throws Exception - { - MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); - ObjectName name = ObjectName.getInstance("hornetq:module=test,type=TestClusterManager"); - mbeanServer.registerMBean(new TestClusterManager(), name); - } - - public void extendPluginClasspath(String element) throws MojoExecutionException - { - ClassWorld world = new ClassWorld(); - ClassRealm realm; - try - { - realm = world.newRealm( - "maven.plugin." + getClass().getSimpleName() + ((nodeId == null) ? "" : nodeId), - Thread.currentThread() - .getContextClassLoader() - ); - File elementFile = new File(element); - getLog().debug("Adding element to plugin classpath" + elementFile.getPath()); - realm.addConstituent(elementFile.toURI() - .toURL()); - } - catch (Exception ex) - { - throw new MojoExecutionException(ex.toString(), ex); - } - System.out.println(Arrays.toString(realm.getConstituents())); - Thread.currentThread() - .setContextClassLoader(realm.getClassLoader()); - } -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStopPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStopPlugin.java deleted file mode 100644 index 98f7b24790..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ActiveMQStopPlugin.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.maven; - -import java.io.File; -import java.io.IOException; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; - -@Mojo(name = "stop", defaultPhase = LifecyclePhase.VERIFY) -public class ActiveMQStopPlugin extends AbstractMojo -{ - - /** - * @parameter - */ - private String configurationDir; - - public void execute() throws MojoExecutionException, MojoFailureException - { - String property = System.getProperty(ActiveMQStartPlugin.SKIPBROKERSTART); - if (property != null) - { - return; - } - try - { - String dirName = configurationDir != null ? configurationDir : "."; - final File file = new File(dirName + "/" + "/STOP_ME"); - file.createNewFile(); - long time = System.currentTimeMillis(); - while (System.currentTimeMillis() < time + 60000) - { - if (!file.exists()) - { - break; - } - try - { - Thread.sleep(200); - } - catch (InterruptedException e) - { - //ignore - } - } - if (file.exists()) - { - throw new MojoExecutionException("looks like the server hasn't been stopped"); - } - } - catch (IOException e) - { - e.printStackTrace(); - throw new MojoExecutionException(e.getMessage()); - } - } -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java new file mode 100644 index 0000000000..79aad50fc3 --- /dev/null +++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java @@ -0,0 +1,172 @@ +/** + * 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.maven; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.util.Map; + +import org.apache.activemq.artemis.cli.Artemis; +import org.apache.activemq.artemis.cli.commands.Run; +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; + +@Mojo(name = "cli", defaultPhase = LifecyclePhase.VERIFY) +public class ArtemisCLIPlugin extends AbstractMojo + +{ + + @Parameter + String name; + + /** + * The plugin descriptor + */ + private PluginDescriptor descriptor; + + @Parameter(defaultValue = "${activemq.basedir}", required = true) + private File home; + + @Parameter(defaultValue = "${activemq.basedir}/artemis-distribution/target/apache-artemis-${project.version}-bin/apache-artemis-${project.version}/", required = true) + private File alternateHome; + + @Parameter(defaultValue = "${basedir}/target/server0", required = true) + private File location; + + @Parameter + private String[] args; + + @Parameter + private boolean spawn = false; + + @Parameter + private boolean testServer; + + + /** + * Validate if the directory is a artemis.home * + * + * @param path + * @return + */ + private boolean lookupHome(Path path) + { + + if (path == null) + { + return false; + } + + Path binFolder = path.resolve("bin"); + + if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS)) + { + return false; + } + + Path artemisScript = binFolder.resolve("artemis"); + + + return artemisScript != null && Files.exists(artemisScript, LinkOption.NOFOLLOW_LINKS); + + + } + + public void execute() throws MojoExecutionException, MojoFailureException + { + // This is to avoid the Run issuing a kill at any point + Run.setEmbedded(true); + + MavenProject project = (MavenProject) getPluginContext().get("project"); + + + if (!lookupHome(home.toPath())) + { + if (lookupHome(alternateHome.toPath())) + { + home = alternateHome; + } + else + { + getLog().error("********************************************************************************************"); + getLog().error("Could not locate suitable Artemis.home on either " + home + " or " + alternateHome); + getLog().error("Use the binary distribution or build the distribution before running the examples"); + getLog().error("********************************************************************************************"); + + throw new MojoExecutionException("Couldn't find artemis.home"); + } + } + + Map properties = getPluginContext(); + + try + { + if (spawn) + { + final Process process = org.apache.activemq.artemis.cli.process.ProcessBuilder.build("server", location, true, args); + Runtime.getRuntime().addShutdownHook(new Thread() + { + public void run() + { + process.destroy(); + } + }); + + if (testServer) + { + for (int tryNr = 0; tryNr < 20; tryNr++) + { + try + { + ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(); + cf.createConnection().close(); + getLog().info("Server started"); + } + catch (Exception e) + { + getLog().info("awaiting server to start"); + Thread.sleep(500); + continue; + } + break; + } + } + } + else + { + Artemis.execute(home, location, args); + } + + Thread.sleep(600); + + org.apache.activemq.artemis.cli.process.ProcessBuilder.cleanupProcess(); + } + catch (Exception e) + { + throw new MojoExecutionException(e.getMessage(), e); + } + } +} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/InVMNodeManagerServer.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/InVMNodeManagerServer.java deleted file mode 100644 index b8b1a67e9f..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/InVMNodeManagerServer.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.maven; - -import javax.management.MBeanServer; - -import java.io.File; - -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.server.NodeManager; -import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; -import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; - -public final class InVMNodeManagerServer extends ActiveMQServerImpl -{ - final NodeManager nodeManager; - - public InVMNodeManagerServer(final NodeManager nodeManager) - { - super(); - this.nodeManager = nodeManager; - } - - public InVMNodeManagerServer(final Configuration configuration, final NodeManager nodeManager) - { - super(configuration); - this.nodeManager = nodeManager; - } - - public InVMNodeManagerServer(final Configuration configuration, - final MBeanServer mbeanServer, - final NodeManager nodeManager) - { - super(configuration, mbeanServer); - this.nodeManager = nodeManager; - } - - public InVMNodeManagerServer(final Configuration configuration, - final ActiveMQSecurityManager securityManager, - final NodeManager nodeManager) - { - super(configuration, securityManager); - this.nodeManager = nodeManager; - } - - public InVMNodeManagerServer(final Configuration configuration, - final MBeanServer mbeanServer, - final ActiveMQSecurityManager securityManager, - final NodeManager nodeManager) - { - super(configuration, mbeanServer, securityManager); - this.nodeManager = nodeManager; - } - - @Override - protected NodeManager createNodeManager(final File directory, boolean replicatingBackup) - { - return nodeManager; - } - -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/LibInstallPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/LibInstallPlugin.java new file mode 100644 index 0000000000..e65108d8d9 --- /dev/null +++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/LibInstallPlugin.java @@ -0,0 +1,147 @@ +/** + * 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.maven; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.List; +import java.util.Map; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; + +@Mojo(name = "lib-install", defaultPhase = LifecyclePhase.VERIFY) +public class LibInstallPlugin extends AbstractMojo + +{ + + @Parameter + String name; + + /** + * The plugin descriptor + */ + private PluginDescriptor descriptor; + + @Parameter(defaultValue = "${basedir}/target/server0", required = true) + private File instance; + + @Component + private RepositorySystem repositorySystem; + + @Parameter(defaultValue = "${repositorySystemSession}") + private RepositorySystemSession repoSession; + + @Parameter(defaultValue = "${project.remoteProjectRepositories}") + private List remoteRepos; + + + @Parameter + private String[] libList; + + @Parameter(defaultValue = "${localRepository}") + private org.apache.maven.artifact.repository.ArtifactRepository localRepository; + + public void execute() throws MojoExecutionException, MojoFailureException + { + MavenProject project = (MavenProject) getPluginContext().get("project"); + + Map properties = getPluginContext(); + + try + { + + File projectLib = project.getArtifact().getFile(); + copyToLib(projectLib); + + if (libList != null) + { + for (int i = 0; i < libList.length; i++) + { + String[] splitString = libList[i].split(":"); + + getLog().info("********************" + splitString[0] + "/" + splitString[1] + "/" + splitString[2]); + + Artifact artifact; + try + { + artifact = new DefaultArtifact(libList[i]); + } + catch (IllegalArgumentException e) + { + throw new MojoFailureException(e.getMessage(), e); + } + + ArtifactRequest request = new ArtifactRequest(); + request.setArtifact(artifact); + request.setRepositories(remoteRepos); + + getLog().info("Resolving artifact " + artifact + " from " + remoteRepos); + + ArtifactResult result; + try + { + result = repositorySystem.resolveArtifact(repoSession, request); + } + catch (ArtifactResolutionException e) + { + throw new MojoExecutionException(e.getMessage(), e); + } + + File artifactFile = result.getArtifact().getFile(); + + getLog().info("Artifact:: " + artifact + " file = " + artifactFile); + + copyToLib(artifactFile); + + } + } + + } + catch (Exception e) + { + getLog().error(e); + throw new MojoFailureException(e.getMessage()); + } + } + + private void copyToLib(File projectLib) throws IOException + { + Path target = instance.toPath().resolve("lib").resolve(projectLib.getName()); + target.toFile().mkdirs(); + getLog().info("Copying " + projectLib.getName() + " as " + target.toFile().getAbsolutePath()); + Files.copy(projectLib.toPath(), target, StandardCopyOption.REPLACE_EXISTING); + } +} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/PluginUtil.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/PluginUtil.java deleted file mode 100644 index a3f350532f..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/PluginUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.maven; - -import javax.management.MBeanServerConnection; -import javax.management.MBeanServerInvocationHandler; -import javax.management.ObjectName; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXServiceURL; -import java.util.HashMap; - -public class PluginUtil -{ - public static TestClusterManagerMBean getTestClusterManager() - { - final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi"; - try - { - JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap()); - ObjectName name = ObjectName.getInstance("activemq:module=test,type=TestClusterManager"); - MBeanServerConnection mbsc = connector.getMBeanServerConnection(); - TestClusterManagerMBean clusterControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, - name, - TestClusterManagerMBean.class, - false); - clusterControl.getNumNodes();//serves as a validation. - return clusterControl; - } - catch (Exception e) - { - return null; - } - } - -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManager.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManager.java deleted file mode 100644 index 7f7aced2b5..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManager.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.maven; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -public class TestClusterManager implements TestClusterManagerMBean -{ - private final List testNodes = new ArrayList(); - - @Override - public int getNumNodes() - { - synchronized (testNodes) - { - return testNodes.size(); - } - } - - @Override - public void registerNode(String nodeId, String workingDir, - String hornetqConfigurationDir) - { - synchronized (testNodes) - { - testNodes.add(new TestNode(nodeId, workingDir, hornetqConfigurationDir)); - } - } - - @Override - public void killNode(int i) throws IOException - { - TestNode node = testNodes.get(i); - node.kill(); - } -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestNode.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestNode.java deleted file mode 100644 index 1de6a0cd6f..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestNode.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.maven; - -import java.io.File; -import java.io.IOException; - -public class TestNode -{ - String nodeId; - String workingDir; - String configDir; - - public TestNode(String nodeId, String workingDir, - String configDir) - { - this.nodeId = nodeId; - this.workingDir = workingDir; - this.configDir = configDir; - } - - public void kill() throws IOException - { - File file = new File(configDir, "KILL_ME"); - file.createNewFile(); - try - { - Thread.sleep(3000); - } - catch (InterruptedException e) - { - } - } - -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/ActiveMQBootstrap.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/ActiveMQBootstrap.java deleted file mode 100644 index 35f38da1d8..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/ActiveMQBootstrap.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.server; - -import java.io.File; -import java.lang.management.ManagementFactory; -import java.util.HashMap; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; - -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.FileDeploymentManager; -import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; -import org.apache.activemq.artemis.core.config.impl.FileConfiguration; -import org.apache.activemq.artemis.core.config.impl.FileSecurityConfiguration; -import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; -import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.server.JournalType; -import org.apache.activemq.artemis.core.server.NodeManager; -import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; -import org.apache.activemq.artemis.core.server.impl.InVMNodeManager; -import org.apache.activemq.artemis.jms.server.JMSServerManager; -import org.apache.activemq.artemis.jms.server.config.JMSConfiguration; -import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl; -import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration; -import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; -import org.apache.activemq.artemis.maven.InVMNodeManagerServer; -import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; -import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl; - -/** - * This will bootstrap the HornetQ Server and also the naming server if required - */ -public class ActiveMQBootstrap -{ - private final String configurationDir; - - private final Boolean waitOnStart; - - private final String nodeId; - - private static Map managerMap = new HashMap(); - - private boolean spawned = false; - - private ActiveMQServer server; - - private Configuration configuration; - - private JMSConfiguration jmsFileConfiguration; - - private SecurityConfiguration securityConfiguration; - - private JMSServerManager manager; - - private ActiveMQSecurityManager securityManager; - - - public ActiveMQBootstrap(String configurationDir, Boolean waitOnStart, String nodeId, ActiveMQSecurityManager securityManager) - { - this.configurationDir = configurationDir; - this.waitOnStart = waitOnStart; - this.nodeId = nodeId; - this.securityManager = securityManager; - } - - public ActiveMQBootstrap(String[] args) - { - this.configurationDir = args[0]; - this.waitOnStart = Boolean.valueOf(args[1]); - this.nodeId = args[2]; - spawned = true; - } - - public void execute() throws Exception - { - try - { - if (configurationDir != null) - { - //extendPluginClasspath(configurationDir); - configuration = new FileConfiguration(); - File file = new File(new File(configurationDir), "broker.xml"); - jmsFileConfiguration = new FileJMSConfiguration(); - FileDeploymentManager deploymentManager = new FileDeploymentManager(file.toURI().toString()); - deploymentManager.addDeployable((FileConfiguration)configuration); - deploymentManager.addDeployable((FileJMSConfiguration) jmsFileConfiguration); - - securityConfiguration = new FileSecurityConfiguration(new File(configurationDir, "artemis-users.properties").toURI().toString(), - new File(configurationDir, "artemis-roles.properties").toURI().toString(), - "guest", - false, - null); - ((FileSecurityConfiguration)securityConfiguration).start(); - deploymentManager.readConfiguration(); - } - else - { - configuration = new ConfigurationImpl(); - configuration.setJournalType(JournalType.NIO); - jmsFileConfiguration = new JMSConfigurationImpl(); - securityConfiguration = new SecurityConfiguration(); - } - - createServer(configuration, jmsFileConfiguration); - - if (waitOnStart) - { - String dirName = System.getProperty("activemq.config.dir", "."); - final File file = new File(dirName + "/STOP_ME"); - if (file.exists()) - { - file.delete(); - } - - while (!file.exists()) - { - Thread.sleep(500); - } - - manager.stop(); - file.delete(); - } - else - { - String dirName = configurationDir != null ? configurationDir : "."; - final File stopFile = new File(dirName + "/STOP_ME"); - if (stopFile.exists()) - { - stopFile.delete(); - } - final File killFile = new File(dirName + "/KILL_ME"); - if (killFile.exists()) - { - killFile.delete(); - } - final File restartFile = new File(dirName + "/RESTART_ME"); - if (restartFile.exists()) - { - restartFile.delete(); - } - final Timer timer = new Timer("ActiveMQ Artemis Server Shutdown Timer", false); - timer.scheduleAtFixedRate(new ServerStopTimerTask(stopFile, killFile, restartFile, timer), 500, 500); - } - } - catch (Exception e) - { - e.printStackTrace(); - throw new Exception(e.getMessage()); - } - } - - private void createServer(Configuration configuration, JMSConfiguration jmsFileConfiguration) throws Exception - { - if (nodeId != null && !nodeId.equals("") && !nodeId.equals("null")) - { - InVMNodeManager nodeManager = (InVMNodeManager) managerMap.get(nodeId); - if (nodeManager == null) - { - boolean replicatedBackup = configuration.getHAPolicyConfiguration().getType() == HAPolicyConfiguration.TYPE.REPLICA; - nodeManager = new InVMNodeManager(replicatedBackup, configuration.getJournalLocation()); - managerMap.put(nodeId, nodeManager); - } - server = new InVMNodeManagerServer(configuration, ManagementFactory.getPlatformMBeanServer(), - securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl(securityConfiguration), nodeManager); - } - else - { - server = new ActiveMQServerImpl(configuration, ManagementFactory.getPlatformMBeanServer(), - securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl(securityConfiguration)); - } - - manager = new JMSServerManagerImpl(server, jmsFileConfiguration); - manager.start(); - } - - private class ServerStopTimerTask extends TimerTask - { - private final File stopFile; - private final Timer timer; - private final File killFile; - private final File restartFile; - - public ServerStopTimerTask(File stopFile, File killFile, File restartFile, Timer timer) - { - this.stopFile = stopFile; - this.killFile = killFile; - this.restartFile = restartFile; - this.timer = timer; - } - - @Override - public void run() - { - if (stopFile.exists()) - { - try - { - timer.cancel(); - } - finally - { - try - { - if (manager != null) - { - manager.stop(); - manager = null; - } - server = null; - stopFile.delete(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - if (spawned) - { - Runtime.getRuntime() - .halt(666); - } - } - else if (killFile.exists()) - { - try - { - manager.getActiveMQServer() - .stop(true); - manager.stop(); - manager = null; - server = null; - killFile.delete(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - else if (restartFile.exists()) - { - try - { - createServer(configuration, jmsFileConfiguration); - restartFile.delete(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } - } -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedActiveMQBootstrap.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedActiveMQBootstrap.java deleted file mode 100644 index c7829d8a83..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedActiveMQBootstrap.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.server; - -/** - * This class will be spawned in a new vm and will call the bootstrap - */ -public class SpawnedActiveMQBootstrap -{ - public static void main(final String[] args) - { - ActiveMQBootstrap bootstrap; - try - { - bootstrap = new ActiveMQBootstrap(args); - bootstrap.execute(); - System.out.println("STARTED::"); - } - catch (Throwable e) - { - System.out.println("FAILED::" + e.getMessage()); - } - } -} diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedVMSupport.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedVMSupport.java deleted file mode 100644 index f67fa35ae6..0000000000 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/server/SpawnedVMSupport.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.server; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.apache.maven.artifact.Artifact; - -public class SpawnedVMSupport -{ - public static Process spawnVM(List arts, - final String logName, - final String className, - final Properties properties, - final boolean logOutput, - final String success, - final String failure, - final String workDir, - final String configDir, - boolean debug, - final String... args) throws Exception - { - StringBuffer sb = new StringBuffer(); - - sb.append("java") - .append(' '); - StringBuffer props = new StringBuffer(); - if (properties != null) - { - for (Map.Entry entry : properties.entrySet()) - { - props.append("-D") - .append(entry.getKey()) - .append("=") - .append(entry.getValue()) - .append(" "); - } - } - String vmarg = props.toString(); - String osName = System.getProperty("os.name"); - osName = (osName != null) ? osName.toLowerCase() : ""; - boolean isWindows = osName.contains("win"); - if (isWindows) - { - vmarg = vmarg.replaceAll("/", "\\\\"); - } - sb.append(vmarg) - .append(" "); - String pathSeparater = System.getProperty("path.separator"); - StringBuilder classpath = new StringBuilder(); - for (Artifact artifact : arts) - { - classpath.append(artifact.getFile() - .getAbsolutePath()) - .append(pathSeparater); - } - classpath.append(configDir) - .append(pathSeparater); - - if (isWindows) - { - sb.append("-cp") - .append(" \"") - .append(classpath.toString()) - .append("\" "); - } - else - { - sb.append("-cp") - .append(" ") - .append(classpath.toString()) - .append(" "); - } - - // FIXME - not good to assume path separator - String libPath = "-Djava.library.path=" + System.getProperty("java.library.path", "./native/bin"); - if (isWindows) - { - libPath = libPath.replaceAll("/", "\\\\"); - libPath = "\"" + libPath + "\""; - } - sb.append("-Djava.library.path=") - .append(libPath) - .append(" "); - if (debug) - { - sb.append("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 "); - } - - sb.append(className) - .append(' '); - - for (String arg : args) - { - sb.append(arg) - .append(' '); - } - - String commandLine = sb.toString(); - - //SpawnedVMSupport.log.trace("command line: " + commandLine); - - Process process = Runtime.getRuntime() - .exec(commandLine, null, new File(workDir)); - - //SpawnedVMSupport.log.trace("process: " + process); - - CountDownLatch latch = new CountDownLatch(1); - - ProcessLogger outputLogger = new ProcessLogger(logOutput, - process.getInputStream(), - logName, - false, - success, - failure, - latch); - outputLogger.start(); - - // Adding a reader to System.err, so the VM won't hang on a System.err.println as identified on this forum thread: - // http://www.jboss.org/index.html?module=bb&op=viewtopic&t=151815 - ProcessLogger errorLogger = new ProcessLogger(true, - process.getErrorStream(), - logName, - true, - success, - failure, - latch); - errorLogger.start(); - - if (!latch.await(60, TimeUnit.SECONDS)) - { - process.destroy(); - throw new RuntimeException("Timed out waiting for server to start"); - } - - if (outputLogger.failed || errorLogger.failed) - { - try - { - process.destroy(); - } - catch (Throwable e) - { - } - throw new RuntimeException("server failed to start"); - } - return process; - } - - /** - * Redirect the input stream to a logger (as debug logs) - */ - static class ProcessLogger extends Thread - { - private final InputStream is; - - private final String logName; - - private final boolean print; - - private final boolean sendToErr; - - private final String success; - - private final String failure; - - private final CountDownLatch latch; - - boolean failed = false; - - ProcessLogger(final boolean print, - final InputStream is, - final String logName, - final boolean sendToErr, - final String success, - final String failure, - final CountDownLatch latch) throws ClassNotFoundException - { - this.is = is; - this.print = print; - this.logName = logName; - this.sendToErr = sendToErr; - this.success = success; - this.failure = failure; - this.latch = latch; - setDaemon(false); - } - - @Override - public void run() - { - try - { - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - String line; - while ((line = br.readLine()) != null) - { - if (line.startsWith(success)) - { - failed = false; - latch.countDown(); - } - else if (line.startsWith(failure)) - { - failed = true; - latch.countDown(); - } - if (print) - { - if (sendToErr) - { - System.err.println(logName + " err:" + line); - } - else - { - System.out.println(logName + " out:" + line); - } - } - } - } - catch (IOException e) - { - // ok, stream closed - } - - } - } -} diff --git a/examples/jms/aerogear/pom.xml b/examples/jms/aerogear/pom.xml index 1e7bfe99ff..f99707ba32 100644 --- a/examples/jms/aerogear/pom.xml +++ b/examples/jms/aerogear/pom.xml @@ -31,6 +31,7 @@ under the License. + 2.2.1 ${project.basedir}/../../.. @@ -40,13 +41,46 @@ under the License. - org.apache.activemq.examples.jms - common + org.apache.activemq + artemis-cli ${project.version} + + - org.apache.geronimo.specs - geronimo-jms_2.0_spec + org.apache.maven + maven-artifact + ${mavenVersion} + + + org.apache.maven + maven-plugin-api + ${mavenVersion} + + + org.apache.maven + maven-project + ${mavenVersion} + + + org.apache.maven + maven-model + ${mavenVersion} + + + org.apache.maven + maven-core + ${mavenVersion} + + + org.apache.maven + maven-artifact-manager + ${mavenVersion} + + + org.apache.maven + maven-repository-metadata + ${mavenVersion} @@ -60,29 +94,39 @@ under the License. artemis-maven-plugin - start + create - start + create + - - - data.dir - ${basedir}/target/ - - - endpoint - ${endpoint} - - - applicationid - ${applicationid} - - - mastersecret - ${mastersecret} - - + + + org.apache.activemq:artemis-aerogear-integration:${project.version} + org.jboss.aerogear:unifiedpush-java-client:1.0.0 + net.iharder:base64:2.3.8 + com.fasterxml.jackson.core:jackson-annotations:2.3.0 + com.fasterxml.jackson.core:jackson-core:2.3.0 + org.jboss.resteasy:resteasy-jackson-provider:2.3.2.Final + org.codehaus.jackson:jackson-core-asl:1.8.5 + org.codehaus.jackson:jackson-mapper-asl:1.8.5 + org.codehaus.jackson:jackson-jaxrs:1.8.5 + org.codehaus.jackson:jackson-xc:1.8.5 + + + + + start + + cli + + + true + true + + + run + @@ -93,15 +137,20 @@ under the License. org.apache.activemq.artemis.jms.example.AerogearExample - tcp://localhost:61616 + ${basedir}/target/server0 stop - stop + cli + + + stop + + @@ -110,45 +159,7 @@ under the License. artemis-jms-aerogear-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} - - - org.apache.activemq - artemis-aerogear-integration - ${project.version} - - - io.netty - netty-all - ${netty.version} - - - org.apache.geronimo.specs - geronimo-jms_2.0_spec - - - false - ${basedir}/target/classes/activemq/server0 - diff --git a/examples/jms/aerogear/src/main/java/org/apache/activemq/artemis/jms/example/AerogearExample.java b/examples/jms/aerogear/src/main/java/org/apache/activemq/artemis/jms/example/AerogearExample.java index c22b0daaf0..346b8a1cb3 100644 --- a/examples/jms/aerogear/src/main/java/org/apache/activemq/artemis/jms/example/AerogearExample.java +++ b/examples/jms/aerogear/src/main/java/org/apache/activemq/artemis/jms/example/AerogearExample.java @@ -19,27 +19,17 @@ package org.apache.activemq.artemis.jms.example; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Message; -import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; 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 AerogearExample extends ActiveMQExample +public class AerogearExample { - public static void main(final String[] args) - { - new AerogearExample().run(args); - } - - @Override - public boolean runExample() throws Exception + public static void main(final String[] args) throws Exception { Connection connection = null; InitialContext initialContext = null; @@ -75,8 +65,6 @@ public class AerogearExample extends ActiveMQExample System.out.println("now check your mobile app and press enter"); System.in.read(); - - return true; } finally { diff --git a/examples/jms/aerogear/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/aerogear/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/aerogear/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/aerogear/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/aerogear/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/aerogear/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/aerogear/src/main/resources/activemq/server0/broker.xml b/examples/jms/aerogear/src/main/resources/activemq/server0/broker.xml index 8645df43a3..90c93e6a35 100644 --- a/examples/jms/aerogear/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/aerogear/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 @@ -52,7 +52,7 @@ under the License. - org.apache.activemq.integration.aerogear.AeroGearConnectorServiceFactory + org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory diff --git a/examples/jms/application-layer-failover/pom.xml b/examples/jms/application-layer-failover/pom.xml index 797cbe6008..9f4abb583d 100644 --- a/examples/jms/application-layer-failover/pom.xml +++ b/examples/jms/application-layer-failover/pom.xml @@ -57,23 +57,22 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - INFO: AMQ221001 - true + ${basedir}/target/server1 + 1 @@ -84,33 +83,9 @@ under the License. org.apache.activemq.artemis.jms.example.ApplicationLayerFailoverExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -120,41 +95,7 @@ under the License. artemis-jms-application-layer-failover-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/application-layer-failover/src/main/java/org/apache/activemq/artemis/jms/example/ApplicationLayerFailoverExample.java b/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/artemis/jms/example/ApplicationLayerFailoverExample.java index 46900f280b..ca916ee908 100644 --- a/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/artemis/jms/example/ApplicationLayerFailoverExample.java +++ b/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/artemis/jms/example/ApplicationLayerFailoverExample.java @@ -99,7 +99,11 @@ public class ApplicationLayerFailoverExample extends ActiveMQExample System.out.println("Killing the server"); - killServer(0, 1); + killServer(0); + + // this utility method will wait for the server1 to be activated + waitForServerStart(1, 20000); + // Step 6. Wait for the client side to register the failure and reconnect diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/application-layer-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/application-layer-failover/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/application-layer-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/application-layer-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 74270c7d0d..0000000000 --- a/examples/jms/application-layer-failover/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - tcp://localhost:61616 - - - - - - - - - - - - - - - - - target/data/journal - target/data/bindings - target/data/large-messages - - diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/application-layer-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/application-layer-failover/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/application-layer-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/application-layer-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/broker.xml deleted file mode 100644 index bc5ad7144b..0000000000 --- a/examples/jms/application-layer-failover/src/main/resources/activemq/server1/broker.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - tcp://localhost:61617 - - - - - - - - - - - - - - - - - target/data/journal - target/data/bindings - target/data/large-messages - - diff --git a/examples/jms/bridge/pom.xml b/examples/jms/bridge/pom.xml index db872debcc..f1dd547e1d 100644 --- a/examples/jms/bridge/pom.xml +++ b/examples/jms/bridge/pom.xml @@ -62,59 +62,37 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + 1 runClient - runClient + client org.apache.activemq.artemis.jms.example.BridgeExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -129,21 +107,11 @@ under the License. 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 @@ -155,15 +123,6 @@ under the License. ${geronimo.jms.2.spec.version} - - false - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java b/examples/jms/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java index 520c52972e..4346c32498 100644 --- a/examples/jms/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java +++ b/examples/jms/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Message; @@ -26,6 +24,7 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; diff --git a/examples/jms/bridge/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/bridge/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/bridge/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/bridge/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/bridge/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/bridge/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/bridge/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/bridge/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/bridge/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/bridge/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/bridge/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/bridge/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/browser/pom.xml b/examples/jms/browser/pom.xml index 6f86c76596..530f66b83c 100644 --- a/examples/jms/browser/pom.xml +++ b/examples/jms/browser/pom.xml @@ -57,9 +57,10 @@ under the License. artemis-maven-plugin - start + create + verify - start + create @@ -70,16 +71,10 @@ under the License. org.apache.activemq.artemis.jms.example.QueueBrowserExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -87,47 +82,7 @@ under the License. artemis-jms-browser-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java b/examples/jms/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java index d57f34acb4..8e8e422412 100644 --- a/examples/jms/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java +++ b/examples/jms/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Enumeration; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -27,6 +25,7 @@ import javax.jms.QueueBrowser; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Enumeration; import org.apache.activemq.artemis.common.example.ActiveMQExample; diff --git a/examples/jms/browser/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/browser/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/browser/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/browser/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/browser/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/browser/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/browser/src/main/resources/activemq/server0/broker.xml b/examples/jms/browser/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 50039913ca..0000000000 --- a/examples/jms/browser/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/client-kickoff/pom.xml b/examples/jms/client-kickoff/pom.xml index c141afbc50..22d511c972 100644 --- a/examples/jms/client-kickoff/pom.xml +++ b/examples/jms/client-kickoff/pom.xml @@ -62,35 +62,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - true - - - data.dir - ${basedir}/target/ - - - com.sun.management.jmxremote - - - - com.sun.management.jmxremote.port - 3000 - - - com.sun.management.jmxremote.ssl - false - - - com.sun.management.jmxremote.authenticate - false - - + + -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false @@ -101,16 +79,10 @@ under the License. org.apache.activemq.artemis.jms.example.ClientKickoffExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -118,41 +90,7 @@ under the License. artemis-jms-client-kickoff-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/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java b/examples/jms/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java index 597ea5fc40..eb5db60e43 100644 --- a/examples/jms/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java +++ b/examples/jms/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.HashMap; -import java.util.concurrent.atomic.AtomicReference; - import javax.jms.ExceptionListener; import javax.jms.JMSException; import javax.jms.QueueConnection; @@ -30,6 +27,8 @@ import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.naming.InitialContext; +import java.util.HashMap; +import java.util.concurrent.atomic.AtomicReference; import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; diff --git a/examples/jms/client-kickoff/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/client-kickoff/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-kickoff/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/client-kickoff/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/client-kickoff/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-kickoff/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/client-side-failoverlistener/pom.xml b/examples/jms/client-side-failoverlistener/pom.xml index 1c7bf64ffd..87c41f334d 100644 --- a/examples/jms/client-side-failoverlistener/pom.xml +++ b/examples/jms/client-side-failoverlistener/pom.xml @@ -57,42 +57,28 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ../../shared/ + true + false - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ../../shared/ + true + true + 1 @@ -103,30 +89,10 @@ under the License. org.apache.activemq.artemis.jms.example.ClientSideFailoverListerExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 + + ${basedir}/target/server0 + ${basedir}/target/server1 + @@ -136,46 +102,7 @@ under the License. artemis-jms-client-side-fileoverlistener-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/artemis/jms/example/ClientSideFailoverListerExample.java b/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/artemis/jms/example/ClientSideFailoverListerExample.java index 20c8808b95..c7530003c0 100644 --- a/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/artemis/jms/example/ClientSideFailoverListerExample.java +++ b/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/artemis/jms/example/ClientSideFailoverListerExample.java @@ -38,11 +38,23 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnection; */ public class ClientSideFailoverListerExample extends ActiveMQExample { - public static void main(final String[] args) + public static void main(final String[] args) throws Exception { new ClientSideFailoverListerExample().run(args); } + @Override + protected void startServers(String[] serversArgs) throws Exception + { + startServer(0, 5000); + + // server 1 is a backup, it's not activated + startServer(1, 0); + + Thread.sleep(1000); + } + + @Override public boolean runExample() throws Exception { diff --git a/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-failoverlistener/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/client-side-failoverlistener/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-failoverlistener/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/client-side-failoverlistener/src/main/resources/activemq/server0/broker.xml b/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 18550ef69d..0000000000 --- a/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,92 +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/client-side-failoverlistener/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-failoverlistener/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/client-side-failoverlistener/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-failoverlistener/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/client-side-failoverlistener/src/main/resources/activemq/server1/broker.xml b/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server1/broker.xml deleted file mode 100644 index eb70455fff..0000000000 --- a/examples/jms/client-side-failoverlistener/src/main/resources/activemq/server1/broker.xml +++ /dev/null @@ -1,93 +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/client-side-load-balancing/pom.xml b/examples/jms/client-side-load-balancing/pom.xml index 0f13c8c1d8..fc4ec4c83d 100644 --- a/examples/jms/client-side-load-balancing/pom.xml +++ b/examples/jms/client-side-load-balancing/pom.xml @@ -57,56 +57,41 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + true + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + true + ${basedir}/target/classes/activemq/server1 + 1 - start2 + create3 - start + create - ${basedir}/target/classes/activemq/server2 - true - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server2 + true + ${basedir}/target/classes/activemq/server2 + 2 + runClient @@ -114,39 +99,11 @@ under the License. org.apache.activemq.artemis.jms.example.ClientSideLoadBalancingExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 + + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 + @@ -156,46 +113,7 @@ under the License. artemis-jms-client-side-load-balancing-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-load-balancing/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/client-side-load-balancing/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-load-balancing/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/client-side-load-balancing/src/main/resources/activemq/server0/broker.xml b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 7d54128a08..0000000000 --- a/examples/jms/client-side-load-balancing/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,92 +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 - 100 - netty-connector - - - - - - ${udp-address:231.7.7.7} - 9876 - 10000 - - - - - -
jms
- netty-connector - 0 - -
-
- - - - - - - - - - - - - - -
- -
diff --git a/examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-load-balancing/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/client-side-load-balancing/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-load-balancing/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/client-side-load-balancing/src/main/resources/activemq/server1/broker.xml b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/broker.xml deleted file mode 100644 index 3d6efdd66e..0000000000 --- a/examples/jms/client-side-load-balancing/src/main/resources/activemq/server1/broker.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - ${data.dir}/server1/data/messaging/bindings - - ${data.dir}/server1/data/messaging/journal - - ${data.dir}/server1/data/messaging/largemessages - - ${data.dir}/server1/data/messaging/paging - - - - tcp://localhost:61617 - - - - - tcp://localhost:61617 - - - - - - ${udp-address:231.7.7.7} - 9876 - 100 - netty-connector - - - - - - ${udp-address:231.7.7.7} - 9876 - 10000 - - - - - -
jms
- netty-connector - 0 - -
-
- - - - - - - - - - - - - - -
- -
diff --git a/examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/artemis-roles.properties b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-load-balancing/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/client-side-load-balancing/src/main/resources/activemq/server2/artemis-users.properties b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/client-side-load-balancing/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/client-side-load-balancing/src/main/resources/activemq/server2/broker.xml b/examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/broker.xml deleted file mode 100644 index e4bcf5e443..0000000000 --- a/examples/jms/client-side-load-balancing/src/main/resources/activemq/server2/broker.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - ${data.dir}/server2/data/messaging/bindings - - ${data.dir}/server2/data/messaging/journal - - ${data.dir}/server2/data/messaging/largemessages - - ${data.dir}/server2/data/messaging/paging - - - - tcp://localhost:61618 - - - - - tcp://localhost:61618 - - - - - - ${udp-address:231.7.7.7} - 9876 - 100 - netty-connector - - - - - - ${udp-address:231.7.7.7} - 9876 - 10000 - - - - - -
jms
- netty-connector - 0 - -
-
- - - - - - - - - - - - - - -
- -
diff --git a/examples/jms/clustered-durable-subscription/pom.xml b/examples/jms/clustered-durable-subscription/pom.xml index 324eed6c29..a23512c66e 100644 --- a/examples/jms/clustered-durable-subscription/pom.xml +++ b/examples/jms/clustered-durable-subscription/pom.xml @@ -57,34 +57,24 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + 1 @@ -95,33 +85,9 @@ under the License. org.apache.activemq.artemis.jms.example.ClusteredDurableSubscriptionExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -131,46 +97,7 @@ under the License. artemis-jms-clustered-durable-subscription-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredDurableSubscriptionExample.java b/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredDurableSubscriptionExample.java index c5b3be41d6..d850f08e58 100644 --- a/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredDurableSubscriptionExample.java +++ b/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredDurableSubscriptionExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -58,7 +57,7 @@ public class ClusteredDurableSubscriptionExample 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", args[0]); + properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616"); properties.put("topic.topic/exampleTopic", "exampleTopic"); ic0 = new InitialContext(properties); @@ -72,7 +71,7 @@ public class ClusteredDurableSubscriptionExample extends ActiveMQExample properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[1]); + 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 diff --git a/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-durable-subscription/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/clustered-durable-subscription/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-durable-subscription/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/clustered-durable-subscription/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-durable-subscription/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/clustered-durable-subscription/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-durable-subscription/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/clustered-grouping/pom.xml b/examples/jms/clustered-grouping/pom.xml index 45fe589faf..a9357cfda2 100644 --- a/examples/jms/clustered-grouping/pom.xml +++ b/examples/jms/clustered-grouping/pom.xml @@ -57,62 +57,35 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + 1 - start2 + create3 - start + create - ${basedir}/target/classes/activemq/server2 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server2 + ${basedir}/target/classes/activemq/server2 + 2 @@ -123,43 +96,10 @@ under the License. org.apache.activemq.artemis.jms.example.ClusteredGroupingExample - tcp://localhost:61616 - tcp://localhost:61617 - tcp://localhost:61618 + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 @@ -169,46 +109,7 @@ under the License. artemis-jms-clustered-grouping-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredGroupingExample.java b/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredGroupingExample.java index 8e40e94677..b13681b858 100644 --- a/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredGroupingExample.java +++ b/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredGroupingExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -60,7 +59,7 @@ public class ClusteredGroupingExample 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", args[0]); + properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616"); properties.put("queue.queue/exampleQueue", "exampleQueue"); ic0 = new InitialContext(properties); @@ -73,7 +72,7 @@ public class ClusteredGroupingExample 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", args[1]); + 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 @@ -82,7 +81,7 @@ public class ClusteredGroupingExample extends ActiveMQExample // Step 4. Get an initial context for looking up JNDI from server 2 properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[2]); + properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61618"); ic2 = new InitialContext(properties); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 2 diff --git a/examples/jms/clustered-grouping/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/clustered-grouping/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-grouping/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/clustered-grouping/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/clustered-grouping/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-grouping/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/clustered-grouping/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-grouping/src/main/resources/activemq/server0/broker.xml index eb20ac8ae9..8b67aa5a34 100644 --- a/examples/jms/clustered-grouping/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-grouping/src/main/resources/activemq/server0/broker.xml @@ -30,13 +30,14 @@ 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:../data}/paging - ${data.dir}/server0/data/messaging/paging diff --git a/examples/jms/clustered-grouping/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/clustered-grouping/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-grouping/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/clustered-grouping/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/clustered-grouping/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-grouping/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/clustered-grouping/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-grouping/src/main/resources/activemq/server1/broker.xml index c544203be3..7ab2e7ed5c 100644 --- a/examples/jms/clustered-grouping/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-grouping/src/main/resources/activemq/server1/broker.xml @@ -30,13 +30,14 @@ 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:../data}/paging - ${data.dir}/server1/data/messaging/paging diff --git a/examples/jms/clustered-grouping/src/main/resources/activemq/server2/artemis-roles.properties b/examples/jms/clustered-grouping/src/main/resources/activemq/server2/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-grouping/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/clustered-grouping/src/main/resources/activemq/server2/artemis-users.properties b/examples/jms/clustered-grouping/src/main/resources/activemq/server2/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-grouping/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/clustered-grouping/src/main/resources/activemq/server2/broker.xml b/examples/jms/clustered-grouping/src/main/resources/activemq/server2/broker.xml index d9f0c6e5f5..1776c5c852 100644 --- a/examples/jms/clustered-grouping/src/main/resources/activemq/server2/broker.xml +++ b/examples/jms/clustered-grouping/src/main/resources/activemq/server2/broker.xml @@ -30,13 +30,14 @@ 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:../data}/paging - ${data.dir}/server2/data/messaging/paging diff --git a/examples/jms/clustered-jgroups/pom.xml b/examples/jms/clustered-jgroups/pom.xml index bd17e32f43..b19deb3b12 100644 --- a/examples/jms/clustered-jgroups/pom.xml +++ b/examples/jms/clustered-jgroups/pom.xml @@ -57,38 +57,32 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - - jgroups.bind_addr - ::1 - - + + + org.jgroups:jgroups:3.6.0.Final + + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - - jgroups.bind_addr - ::1 - - + + + org.jgroups:jgroups:3.6.0.Final + + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + 1 @@ -99,29 +93,11 @@ under the License. org.apache.activemq.artemis.jms.example.ClusteredJgroupsExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - @@ -129,40 +105,7 @@ under the License. clustered-jgroups ${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 - diff --git a/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java b/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java index db066a1cb4..9d7c3dcbd9 100644 --- a/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java +++ b/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -55,7 +54,7 @@ public class ClusteredJgroupsExample 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", args[0]); + properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616"); properties.put("queue.queue/exampleQueue", "exampleQueue"); ic0 = new InitialContext(properties); @@ -68,7 +67,7 @@ public class ClusteredJgroupsExample 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", args[1]); + 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 diff --git a/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-jgroups/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/clustered-jgroups/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-jgroups/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/clustered-jgroups/src/main/resources/activemq/server0/test-jgroups-file_ping.xml b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/test-jgroups-file_ping.xml index 153cbf7821..5fb6ab4b65 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/test-jgroups-file_ping.xml +++ b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/test-jgroups-file_ping.xml @@ -47,7 +47,8 @@ under the License. oob_thread_pool.queue_max_size="100" oob_thread_pool.rejection_policy="run"/> - + + diff --git a/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-jgroups/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/clustered-jgroups/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/clustered-jgroups/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/clustered-jgroups/src/main/resources/activemq/server1/test-jgroups-file_ping.xml b/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/test-jgroups-file_ping.xml index 7013aa52db..1137496030 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/test-jgroups-file_ping.xml +++ b/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/test-jgroups-file_ping.xml @@ -47,7 +47,8 @@ under the License. oob_thread_pool.queue_max_size="100" oob_thread_pool.rejection_policy="run"/> - + + diff --git a/examples/jms/clustered-queue/pom.xml b/examples/jms/clustered-queue/pom.xml index 2924717b6a..d4afa599f7 100644 --- a/examples/jms/clustered-queue/pom.xml +++ b/examples/jms/clustered-queue/pom.xml @@ -57,34 +57,24 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + 1 @@ -95,29 +85,11 @@ under the License. org.apache.activemq.artemis.jms.example.ClusteredQueueExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - @@ -125,40 +97,7 @@ under the License. clustered-queue ${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 - diff --git a/examples/jms/clustered-queue/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredQueueExample.java b/examples/jms/clustered-queue/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredQueueExample.java index 7825c5d147..0011865a49 100644 --- a/examples/jms/clustered-queue/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredQueueExample.java +++ b/examples/jms/clustered-queue/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredQueueExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -56,7 +55,7 @@ public class ClusteredQueueExample 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", args[0]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1); properties.put("queue.queue/exampleQueue", "exampleQueue"); ic0 = new InitialContext(properties); @@ -69,7 +68,7 @@ public class ClusteredQueueExample 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", args[1]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2); ic1 = new InitialContext(properties); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 diff --git a/examples/jms/clustered-standalone/pom.xml b/examples/jms/clustered-standalone/pom.xml index b78aa01a78..1f2249d534 100644 --- a/examples/jms/clustered-standalone/pom.xml +++ b/examples/jms/clustered-standalone/pom.xml @@ -57,50 +57,35 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + 1 - start2 + create3 - start + create - ${basedir}/target/classes/activemq/server2 - true - - - udp-address - ${udp-address} - - + ${basedir}/target/server2 + ${basedir}/target/classes/activemq/server2 + 2 @@ -111,43 +96,10 @@ under the License. org.apache.activemq.artemis.jms.example.ClusteredStandaloneExample - tcp://localhost:61616 - tcp://localhost:61617 - tcp://localhost:61618 + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 @@ -157,36 +109,6 @@ under the License. artemis-jms-clustered-standalone-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} - diff --git a/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredStandaloneExample.java b/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredStandaloneExample.java index 5cb48123f6..9437a8c11e 100644 --- a/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredStandaloneExample.java +++ b/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredStandaloneExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -53,18 +52,18 @@ public class ClusteredStandaloneExample extends ActiveMQExample { Hashtable properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[0]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1); properties.put("topic.topic/exampleTopic", "exampleTopic"); initialContext0 = new InitialContext(properties); properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[1]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2); initialContext1 = new InitialContext(properties); properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[2]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP3); initialContext2 = new InitialContext(properties); // First we demonstrate a distributed topic. @@ -147,7 +146,7 @@ public class ClusteredStandaloneExample extends ActiveMQExample return false; } - // System.out.println("Received message " + message2.getText()); + System.out.println("Received message " + message2.getText()); } producer.close(); diff --git a/examples/jms/clustered-static-discovery/pom.xml b/examples/jms/clustered-static-discovery/pom.xml index 145c6a6425..597bdfb14a 100644 --- a/examples/jms/clustered-static-discovery/pom.xml +++ b/examples/jms/clustered-static-discovery/pom.xml @@ -57,42 +57,46 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + 1 - start2 + create3 - start + create - ${basedir}/target/classes/activemq/server2 - true + ${basedir}/target/server2 + ${basedir}/target/classes/activemq/server2 + 2 - start3 + create4 - start + create - ${basedir}/target/classes/activemq/server3 - true + ${basedir}/target/server3 + ${basedir}/target/classes/activemq/server3 + 3 @@ -103,53 +107,11 @@ under the License. org.apache.activemq.artemis.jms.example.StaticClusteredQueueExample - tcp://localhost:61616 - tcp://localhost:61617 - tcp://localhost:61618 - tcp://localhost:61619 + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 + ${basedir}/target/server3 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 - - - - stop3 - - stop - - - ${basedir}/target/classes/activemq/server3 @@ -159,46 +121,7 @@ under the License. artemis-jms-clustered-static-discovery-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/artemis/jms/example/StaticClusteredQueueExample.java b/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/artemis/jms/example/StaticClusteredQueueExample.java index 22fc066bf2..c7c9efb94f 100644 --- a/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/artemis/jms/example/StaticClusteredQueueExample.java +++ b/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/artemis/jms/example/StaticClusteredQueueExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -60,7 +59,7 @@ public class StaticClusteredQueueExample extends ActiveMQExample // Step 1. Get an initial context for looking up JNDI from server 3 Hashtable properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[3]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP4); properties.put("queue.queue/exampleQueue", "exampleQueue"); ic0 = new InitialContext(properties); diff --git a/examples/jms/clustered-static-oneway/pom.xml b/examples/jms/clustered-static-oneway/pom.xml index cb8f249bff..1c44be407f 100644 --- a/examples/jms/clustered-static-oneway/pom.xml +++ b/examples/jms/clustered-static-oneway/pom.xml @@ -57,32 +57,33 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 - start2 + create3 - start + create - ${basedir}/target/classes/activemq/server2 - true + ${basedir}/target/server2 + ${basedir}/target/classes/activemq/server2 @@ -93,43 +94,10 @@ under the License. org.apache.activemq.artemis.jms.example.ClusterStaticOnewayExample - tcp://localhost:61616 - tcp://localhost:61617 - tcp://localhost:61618 + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 @@ -139,46 +107,7 @@ under the License. artemis-jms-clustered-static-oneway-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/artemis/jms/example/ClusterStaticOnewayExample.java b/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/artemis/jms/example/ClusterStaticOnewayExample.java index 55ffa6ae32..fd1f4e5ca8 100644 --- a/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/artemis/jms/example/ClusterStaticOnewayExample.java +++ b/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/artemis/jms/example/ClusterStaticOnewayExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -58,7 +57,7 @@ public class ClusterStaticOnewayExample 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", args[0]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1); properties.put("queue.queue/exampleQueue", "exampleQueue"); ic0 = new InitialContext(properties); diff --git a/examples/jms/clustered-topic/pom.xml b/examples/jms/clustered-topic/pom.xml index 33617d5621..63a7c2b564 100644 --- a/examples/jms/clustered-topic/pom.xml +++ b/examples/jms/clustered-topic/pom.xml @@ -57,42 +57,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -103,33 +84,9 @@ under the License. org.apache.activemq.artemis.jms.example.ClusteredTopicExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -139,46 +96,7 @@ under the License. artemis-jms-clustered-topic-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/clustered-topic/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredTopicExample.java b/examples/jms/clustered-topic/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredTopicExample.java index 61a7e846e6..eae93666b1 100644 --- a/examples/jms/clustered-topic/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredTopicExample.java +++ b/examples/jms/clustered-topic/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredTopicExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -56,7 +55,7 @@ public class ClusteredTopicExample 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", args[0]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1); properties.put("topic.topic/exampleTopic", "exampleTopic"); ic0 = new InitialContext(properties); @@ -69,7 +68,7 @@ public class ClusteredTopicExample 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", args[1]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2); ic1 = new InitialContext(properties); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 diff --git a/examples/jms/colocated-failover-scale-down/pom.xml b/examples/jms/colocated-failover-scale-down/pom.xml index ac01bed3a4..a0778b0543 100644 --- a/examples/jms/colocated-failover-scale-down/pom.xml +++ b/examples/jms/colocated-failover-scale-down/pom.xml @@ -57,34 +57,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -95,33 +84,9 @@ under the License. org.apache.activemq.artemis.jms.example.ColocatedFailoverScaleDownExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -131,40 +96,7 @@ under the License. colocated-failover-scale-down ${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 - diff --git a/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java b/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java index a794b7a9f6..678fbf9843 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java +++ b/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -35,7 +34,7 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample; */ public class ColocatedFailoverScaleDownExample extends ActiveMQExample { - public static void main(final String[] args) + public static void main(final String[] args) throws Exception { new ColocatedFailoverScaleDownExample().run(args); } @@ -56,12 +55,12 @@ public class ColocatedFailoverScaleDownExample extends ActiveMQExample // 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", args[1]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2); initialContext1 = new InitialContext(properties); properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1 + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); properties.put("queue.queue/exampleQueue", "exampleQueue"); initialContext = new InitialContext(properties); @@ -95,8 +94,8 @@ public class ColocatedFailoverScaleDownExample extends ActiveMQExample // Step 7. Crash server #0, the live server, and wait a little while to make sure // it has really crashed - Thread.sleep(2000); killServer(0); + Thread.sleep(5000); // Step 8. start the connection ready to receive messages diff --git a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml index 9d6d063e57..8c68c8d78a 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml @@ -30,13 +30,13 @@ under the License. - target/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - target/server0/data/messaging/journal + ../../server0/data/messaging/journal - target/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - target/server0/data/messaging/paging + ../../server0/data/messaging/paging diff --git a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml index cda407e7f6..6ad15ef6ac 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml @@ -30,13 +30,13 @@ under the License. - target/server1/data/messaging/bindings + ../../server1/data/messaging/bindings - target/server1/data/messaging/journal + ../../server1/data/messaging/journal - target/server1/data/messaging/largemessages + ../../server1/data/messaging/largemessages - target/server1/data/messaging/paging + ../../server1/data/messaging/paging diff --git a/examples/jms/colocated-failover/pom.xml b/examples/jms/colocated-failover/pom.xml index 5860edf1fa..fb697b2ea4 100644 --- a/examples/jms/colocated-failover/pom.xml +++ b/examples/jms/colocated-failover/pom.xml @@ -57,34 +57,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -95,33 +84,9 @@ under the License. org.apache.activemq.artemis.jms.example.ColocatedFailoverExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -131,40 +96,7 @@ under the License. colocated-failover ${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 - diff --git a/examples/jms/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java b/examples/jms/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java index 0baa7b416a..de823a48dc 100644 --- a/examples/jms/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java +++ b/examples/jms/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -35,7 +34,7 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample; */ public class ColocatedFailoverExample extends ActiveMQExample { - public static void main(final String[] args) + public static void main(final String[] args) throws Exception { new ColocatedFailoverExample().run(args); } @@ -56,12 +55,12 @@ public class ColocatedFailoverExample extends ActiveMQExample // 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", args[1]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2); initialContext1 = new InitialContext(properties); properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1 + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); properties.put("queue.queue/exampleQueue", "exampleQueue"); initialContext = new InitialContext(properties); @@ -95,8 +94,8 @@ public class ColocatedFailoverExample extends ActiveMQExample // Step 7. Crash server #0, the live server, and wait a little while to make sure // it has really crashed - Thread.sleep(2000); killServer(0); + Thread.sleep(5000); // Step 8. start the connection ready to receive messages diff --git a/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml index 363ae96e34..554d01f543 100644 --- a/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml @@ -30,13 +30,13 @@ under the License. - target/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - target/server0/data/messaging/journal + ../../server0/data/messaging/journal - target/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - target/server0/data/messaging/paging + ../../server0/data/messaging/paging diff --git a/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml index 464fdee086..2fda160a71 100644 --- a/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml @@ -30,13 +30,13 @@ under the License. - target/server1/data/messaging/bindings + ../../server1/data/messaging/bindings - target/server1/data/messaging/journal + ../../server1/data/messaging/journal - target/server1/data/messaging/largemessages + ../../server1/data/messaging/largemessages - target/server1/data/messaging/paging + ../../server1/data/messaging/paging diff --git a/examples/jms/common/pom.xml b/examples/jms/common/pom.xml index 9fe2604674..4681cac28a 100644 --- a/examples/jms/common/pom.xml +++ b/examples/jms/common/pom.xml @@ -55,6 +55,11 @@ under the License. artemis-jms-client ${project.version} + + io.netty + netty-all + ${netty.version} + diff --git a/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ActiveMQExample.java b/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ActiveMQExample.java index 637cf3b308..b3b791b5c2 100644 --- a/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ActiveMQExample.java +++ b/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ActiveMQExample.java @@ -16,156 +16,214 @@ */ package org.apache.activemq.artemis.common.example; -import java.io.File; +import javax.jms.Connection; import java.util.HashMap; import java.util.logging.Logger; -import javax.jms.Connection; -import javax.jms.JMSException; - import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.JMSFactoryType; -import org.apache.activemq.artemis.core.client.impl.DelegatingSession; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.artemis.jms.client.ActiveMQConnection; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; /** - * Base class for ActiveMQ Artemis examples. - *

- * This takes care of starting and stopping the server as well as deploying any - * queue needed. + * This cass is a base class for all the tests where we have a few utilities to start and stop servers * */ public abstract class ActiveMQExample { protected static final Logger log = Logger.getLogger(ActiveMQExample.class.getName()); + public static final int DEFAULT_PORT = 61616; + + public static final String DEFAULT_TCP1 = "tcp://localhost:61616"; + public static final String DEFAULT_TCP2 = "tcp://localhost:61617"; + public static final String DEFAULT_TCP3 = "tcp://localhost:61618"; + public static final String DEFAULT_TCP4 = "tcp://localhost:61619"; protected boolean failure = false; - protected String[] args; + protected String[] serversArgs; - public abstract boolean runExample() throws Exception; + protected Process[] processes; - protected void run(final String[] args1) + + // This is to make sure we stop the servers when the example is shutdown + // as we start the servers with the example + Thread hook; + + public void run(String servers[]) { - this.args = args1; - //if we have a cluster of servers wait a while for the cluster to form properly - if(args != null && args.length > 1) - { - System.out.println("****pausing to allow cluster to form****"); - Thread.yield(); - try - { - Thread.sleep(2000); - } - catch (InterruptedException e) - { - //ignore - } - } - try { + setupServers(servers); if (!runExample()) { failure = true; } - System.out.println("example complete"); } - catch (Throwable e) + catch (Throwable throwable) { failure = true; - e.printStackTrace(); + throwable.printStackTrace(); } + finally + { + try + { + stopAllServers(); + } + catch (Throwable ignored) + { + ignored.printStackTrace(); + } + } + reportResultAndExit(); + + } + public abstract boolean runExample() throws Exception; + + public void close() throws Exception + { + + if (hook != null) + { + Runtime.getRuntime().removeShutdownHook(hook); + hook = null; + } + stopAllServers(); + } + + /** This will start the servers */ + private final ActiveMQExample setupServers(String[] serversArgs) throws Exception + { + hook = new Thread() + { + public void run() + { + try + { + System.out.println("Shutting down servers!!!"); + System.out.flush(); + ActiveMQExample.this.stopAllServers(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + }; + + Runtime.getRuntime().addShutdownHook(hook); + this.serversArgs = serversArgs; + + if (serversArgs == null) + { + serversArgs = new String[0]; + } + + processes = new Process[serversArgs.length]; + startServers(serversArgs); + + return this; + } + + protected void startServers(String[] serversArgs) throws Exception + { + for (int i = 0; i < serversArgs.length; i++) + { + startServer(i, 5000); + } + } + + protected void stopAllServers() throws Exception + { + if (processes != null) + { + for (int i = 0; i < processes.length; i++) + { + killServer(i); + } + } } protected void killServer(final int id) throws Exception { - String configDir = System.getProperty("exampleConfigDir"); - if(configDir == null) + if (id > processes.length) { - throw new Exception("exampleConfigDir must be set as a system property"); + System.out.println("**********************************"); + System.out.println("Kill server " + id + " manually, will wait 5 seconds for that being done"); + Thread.sleep(5000); } - System.out.println("Killing server " + id); - - // We kill the server by creating a new file in the server dir which is checked for by the server - // We can't use Process.destroy() since this does not do a hard kill - it causes shutdown hooks - // to be called which cleanly shutdown the server - System.out.println(configDir + "/server" + id + "/KILL_ME"); - File file = new File(configDir + "/server" + id + "/KILL_ME"); - - file.createNewFile(); - - // Sleep longer than the KillChecker check period - Thread.sleep(3000); - } - - protected void killServer(final int id, final int serverToWaitFor) throws Exception - { - String configDir = System.getProperty("exampleConfigDir"); - if(configDir == null) + if (processes[id] != null) { - throw new Exception("exampleConfigDir must be set as a system property"); + System.out.println("**********************************"); + System.out.println("Kill server " + id); + processes[id].destroyForcibly(); + processes[id].waitFor(); +// processes[id].destroy(); + processes[id] = null; + Thread.sleep(1000); } - - System.out.println("Killing server " + id); - - // We kill the server by creating a new file in the server dir which is checked for by the server - // We can't use Process.destroy() since this does not do a hard kill - it causes shutdown hooks - // to be called which cleanly shutdown the server - System.out.println(configDir + "/server" + id + "/KILL_ME"); - File file = new File(configDir + "/server" + id + "/KILL_ME"); - - file.createNewFile(); - - waitForServerStart(serverToWaitFor, 20000); } protected void reStartServer(final int id, final long timeout) throws Exception { - String configDir = System.getProperty("exampleConfigDir"); - if(configDir == null) - { - throw new Exception("exampleConfigDir must be set as a system property"); - } - - System.out.println("restarting server " + id); - - // We kill the server by creating a new file in the server dir which is checked for by the server - // We can't use Process.destroy() since this does not do a hard kill - it causes shutdown hooks - // to be called which cleanly shutdown the server - File file = new File(configDir + "/server" + id + "/RESTART_ME"); - - file.createNewFile(); - - waitForServerStart(id, timeout); - + startServer(id, timeout); } - private void waitForServerStart(int id, long timeout) throws InterruptedException + protected void startServer(final int id, final long timeout) throws Exception + { + if (id > processes.length) + { + System.out.println("**********************************"); + System.out.println("Start server " + id + " manually"); + Thread.sleep(5000); + } + else + { + // if started before, will kill it + if (processes[id] != null) + { + killServer(id); + } + } + + processes[id] = ExampleUtil.startServer(serversArgs[id], "Server_" + id); + + if (timeout != 0) + { + waitForServerStart(id, timeout); + } + else + { + // just some time wait to wait server to form clusters.. etc + Thread.sleep(500); + } + } + + protected void waitForServerStart(int id, long timeoutParameter) throws InterruptedException { // wait for restart - long time = System.currentTimeMillis(); - while (time < System.currentTimeMillis() + timeout) + long timeout = System.currentTimeMillis() + timeoutParameter; + while (System.currentTimeMillis() < timeout) { try { HashMap params = new HashMap(); params.put("host", "localhost"); - params.put("port", 61616 + id); + params.put("port", DEFAULT_PORT + id); TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName(), params); ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration); cf.createConnection().close(); - System.out.println("server restarted"); + System.out.println("server " + id + " started"); } catch (Exception e) { - System.out.println("awaiting server restart"); - Thread.sleep(1000); + System.out.println("awaiting server " + id + " start at " + (DEFAULT_PORT + id)); + Thread.sleep(500); continue; } break; @@ -177,7 +235,7 @@ public abstract class ActiveMQExample ClientSession session = ((ActiveMQConnection) connection).getInitialSession(); TransportConfiguration transportConfiguration = session.getSessionFactory().getConnectorConfiguration(); String port = (String) transportConfiguration.getParams().get("port"); - return Integer.valueOf(port) - 61616; + return Integer.valueOf(port) - DEFAULT_PORT; } protected Connection getServerConnection(int server, Connection... connections) @@ -213,12 +271,4 @@ public abstract class ActiveMQExample System.out.println("#####################"); } } - - protected static final void closeConnection(final Connection connection) throws JMSException - { - if (connection != null) - { - connection.close(); - } - } } diff --git a/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ExampleUtil.java b/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ExampleUtil.java new file mode 100644 index 0000000000..b9bb25d2ff --- /dev/null +++ b/examples/jms/common/src/main/java/org/apache/activemq/artemis/common/example/ExampleUtil.java @@ -0,0 +1,122 @@ +/** + * 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.common.example; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class ExampleUtil +{ + public static Process startServer(String artemisInstance, String serverName) throws Exception + { + boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().trim().startsWith("win"); + + ProcessBuilder builder = null; + if (IS_WINDOWS) + { + builder = new ProcessBuilder("cmd", "/c", "artemis.cmd", "run"); + } + else + { + builder = new ProcessBuilder("./artemis", "run"); + } + + builder.directory(new File(artemisInstance + "/bin")); + + Process process = builder.start(); + + ProcessLogger outputLogger = new ProcessLogger(true, + process.getInputStream(), + serverName + "::Out", + false); + outputLogger.start(); + + // Adding a reader to System.err, so the VM won't hang on a System.err.println as identified on this forum thread: + // http://www.jboss.org/index.html?module=bb&op=viewtopic&t=151815 + ProcessLogger errorLogger = new ProcessLogger(true, + process.getErrorStream(), + serverName + "::Err", + true); + errorLogger.start(); + + return process; + } + + + /** + * Redirect the input stream to a logger (as debug logs) + */ + static class ProcessLogger extends Thread + { + private final InputStream is; + + private final String logName; + + private final boolean print; + + private final boolean sendToErr; + + boolean failed = false; + + ProcessLogger(final boolean print, + final InputStream is, + final String logName, + final boolean sendToErr) throws ClassNotFoundException + { + this.is = is; + this.print = print; + this.logName = logName; + this.sendToErr = sendToErr; + setDaemon(false); + } + + @Override + public void run() + { + try + { + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + String line; + while ((line = br.readLine()) != null) + { + if (print) + { + if (sendToErr) + { + System.err.println(logName + " err:" + line); + } + else + { + System.out.println(logName + " out:" + line); + } + } + } + } + catch (IOException e) + { + // ok, stream closed + } + + } + } + +} diff --git a/examples/jms/consumer-rate-limit/pom.xml b/examples/jms/consumer-rate-limit/pom.xml index 6e4690b7b4..d262b3b833 100644 --- a/examples/jms/consumer-rate-limit/pom.xml +++ b/examples/jms/consumer-rate-limit/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.ConsumerRateLimitExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,41 +85,7 @@ under the License. artemis-jms-consumer-rate-limit-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/dead-letter/pom.xml b/examples/jms/dead-letter/pom.xml index bcec76a7e4..c383d9efba 100644 --- a/examples/jms/dead-letter/pom.xml +++ b/examples/jms/dead-letter/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.DeadLetterExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,41 +85,7 @@ under the License. artemis-jms-dead-letter-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/delayed-redelivery/pom.xml b/examples/jms/delayed-redelivery/pom.xml index 1d696c90e6..4264468a00 100644 --- a/examples/jms/delayed-redelivery/pom.xml +++ b/examples/jms/delayed-redelivery/pom.xml @@ -57,10 +57,14 @@ under the License. artemis-maven-plugin - start + create - start + create + + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + runClient @@ -70,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.DelayedRedeliveryExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -87,47 +85,7 @@ under the License. artemis-jms-delayed-redelivery-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/divert/pom.xml b/examples/jms/divert/pom.xml index d1007d6ba6..260569e353 100644 --- a/examples/jms/divert/pom.xml +++ b/examples/jms/divert/pom.xml @@ -62,22 +62,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -88,33 +89,9 @@ under the License. org.apache.activemq.artemis.jms.example.DivertExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -124,46 +101,7 @@ under the License. artemis-jms-divert-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java b/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java index a4cc663ad4..503aadde44 100644 --- a/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java +++ b/examples/jms/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Message; @@ -28,6 +26,7 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -59,7 +58,7 @@ public class DivertExample extends ActiveMQExample // Step 1. Create an initial context to perform the JNDI lookup on the London server Hashtable properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[0]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1); properties.put("queue.queue/orders", "orders"); properties.put("topic.topic/priceUpdates", "priceUpdates"); properties.put("topic.topic/spyTopic", "spyTopic"); @@ -78,7 +77,7 @@ public class DivertExample extends ActiveMQExample // Step 6. Create an initial context to perform the JNDI lookup on the New York server properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[1]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2); properties.put("topic.topic/newYorkPriceUpdates", "newYorkPriceUpdates"); initialContextNewYork = new InitialContext(properties); diff --git a/examples/jms/durable-subscription/pom.xml b/examples/jms/durable-subscription/pom.xml index 2b37eca9a0..1d408de57e 100644 --- a/examples/jms/durable-subscription/pom.xml +++ b/examples/jms/durable-subscription/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.DurableSubscriptionExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,41 +85,7 @@ under the License. artemis-jms-durable-subscription-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/embedded-simple/pom.xml b/examples/jms/embedded-simple/pom.xml index 7762af3bad..9836ff6670 100644 --- a/examples/jms/embedded-simple/pom.xml +++ b/examples/jms/embedded-simple/pom.xml @@ -73,16 +73,6 @@ under the License. org.apache.activemq.artemis.jms.example.EmbeddedExample - - tcp://localhost:61616 - tcp://localhost:61616 - - - - exampleConfigDir - ${basedir}/target/classes/activemq - - @@ -92,41 +82,7 @@ under the License. artemis-jms-embedded-simple-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/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java index 8221873086..c148dca651 100644 --- a/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ b/examples/jms/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java @@ -16,10 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -27,13 +23,16 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import org.apache.activemq.artemis.api.jms.JMSFactoryType; import org.apache.activemq.artemis.common.example.ActiveMQExample; import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; -import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS; import org.apache.activemq.artemis.jms.server.JMSServerManager; +import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl; -import org.apache.activemq.artemis.api.jms.JMSFactoryType; /** * This example demonstrates how to run an ActiveMQ Artemis embedded with JMS diff --git a/examples/jms/embedded/pom.xml b/examples/jms/embedded/pom.xml index f0eb3f9b90..e39c4a46c0 100644 --- a/examples/jms/embedded/pom.xml +++ b/examples/jms/embedded/pom.xml @@ -73,20 +73,6 @@ under the License. org.apache.activemq.artemis.jms.example.EmbeddedExample - - tcp://localhost:61616 - tcp://localhost:61617 - - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - data.dir - ${basedir}/target/ - - @@ -96,36 +82,6 @@ under the License. artemis-jms-embedded-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} - diff --git a/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java index 9300058556..0c029adf13 100644 --- a/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ b/examples/jms/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.ArrayList; -import java.util.Date; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +23,8 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; +import java.util.ArrayList; +import java.util.Date; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -55,7 +54,7 @@ public final class EmbeddedExample extends ActiveMQExample @Override public boolean runExample() throws Exception { - try + try { // Step 1. Create ActiveMQ Artemis core configuration, and set the properties accordingly diff --git a/examples/jms/expiry/pom.xml b/examples/jms/expiry/pom.xml index 16b081a01c..6133af4dfe 100644 --- a/examples/jms/expiry/pom.xml +++ b/examples/jms/expiry/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.ExpiryExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,41 +85,7 @@ under the License. artemis-jms-expiry-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/ha-policy-autobackup/pom.xml b/examples/jms/ha-policy-autobackup/pom.xml index 1d3dc10cbe..649adf06ec 100644 --- a/examples/jms/ha-policy-autobackup/pom.xml +++ b/examples/jms/ha-policy-autobackup/pom.xml @@ -57,34 +57,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -95,33 +84,9 @@ under the License. org.apache.activemq.artemis.jms.example.HAPolicyAutoBackupExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -131,40 +96,7 @@ under the License. ha-policy-autobackup ${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 - diff --git a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java index 4af82b4ccd..10f858f9bd 100644 --- a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java +++ b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,19 +24,18 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener; import org.apache.activemq.artemis.api.core.client.TopologyMember; import org.apache.activemq.artemis.common.example.ActiveMQExample; -import org.apache.activemq.artemis.jms.client.ActiveMQConnection; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - /** * A simple example that demonstrates server side load-balancing of messages between the queue instances on different * nodes of the cluster. @@ -46,7 +43,7 @@ import java.util.concurrent.TimeUnit; */ public class HAPolicyAutoBackupExample extends ActiveMQExample { - public static void main(final String[] args) + public static void main(final String[] args) throws Exception { new HAPolicyAutoBackupExample().run(args); } @@ -67,13 +64,13 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample // Step 1. Get an initial context for looking up JNDI from server 0 and 1 Hashtable properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1 + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); properties.put("queue.queue/exampleQueue", "exampleQueue"); ic0 = new InitialContext(properties); properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - properties.put("connectionFactory.ConnectionFactory", args[1] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2 + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); ic1 = new InitialContext(properties); // Step 2. Look-up the JMS Queue object from JNDI @@ -128,12 +125,13 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample System.out.println("Got message: " + message0.getText() + " from node 0"); } - // Step 14.now kill server1, messages will be scaled down to server0 - killServer(1); - - // Step 15.close the consumer so it doesnt get any messages + // Step 14.close the consumer so it doesnt get any messages consumer1.close(); + // Step 15.now kill server1, messages will be scaled down to server0 + killServer(1); + Thread.sleep(40000); + // Step 16. we now receive the messages that were on server1 but were scaled down to server0 for (int i = 0; i < numMessages / 2; i++) { diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml index 79dd692a27..db98aa0b67 100644 --- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. - target/server0/data/messaging/bindings + ${data.dir}/server0/data/messaging/bindings - target/server0/data/messaging/journal + ${data.dir}/server0/data/messaging/journal - target/server0/data/messaging/largemessages + ${data.dir}/server0/data/messaging/largemessages - target/server0/data/messaging/paging + ${data.dir}/server0/data/messaging/paging diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml index 7b135ac8e9..760ce0d956 100644 --- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. - target/server1/data/messaging/bindings + ${data.dir}/server0/data/messaging/bindings - target/server1/data/messaging/journal + ${data.dir}/server0/data/messaging/journal - target/server1/data/messaging/largemessages + ${data.dir}/server0/data/messaging/largemessages - target/server1/data/messaging/paging + ${data.dir}/server0/data/messaging/paging diff --git a/examples/jms/http-transport/pom.xml b/examples/jms/http-transport/pom.xml index a61bf1f98c..b13f8009b6 100644 --- a/examples/jms/http-transport/pom.xml +++ b/examples/jms/http-transport/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.HttpTransportExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,47 +85,7 @@ under the License. artemis-jms-http-transport-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml b/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml index 40cf947242..f6062b638a 100644 --- a/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/http-transport/src/main/resources/activemq/server0/broker.xml @@ -41,6 +41,8 @@ under the License. tcp://localhost:8080 + + tcp://localhost:61616 diff --git a/examples/jms/instantiate-connection-factory/pom.xml b/examples/jms/instantiate-connection-factory/pom.xml index 591d4d01c3..17e55431eb 100644 --- a/examples/jms/instantiate-connection-factory/pom.xml +++ b/examples/jms/instantiate-connection-factory/pom.xml @@ -67,17 +67,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -88,16 +84,10 @@ under the License. org.apache.activemq.artemis.jms.example.InstantiateConnectionFactoryExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -105,41 +95,7 @@ under the License. artemis-jms-instantiate-connection-factory-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/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java b/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java index df22bf1d54..85ee7d9525 100644 --- a/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java +++ b/examples/jms/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.HashMap; -import java.util.Map; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +23,8 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; +import java.util.HashMap; +import java.util.Map; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; @@ -61,7 +60,7 @@ public class InstantiateConnectionFactoryExample extends ActiveMQExample // The server port etc. Map connectionParams = new HashMap(); - connectionParams.put(TransportConstants.PORT_PROP_NAME, 61617); + connectionParams.put(TransportConstants.PORT_PROP_NAME, 61616); TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams); diff --git a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml b/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml index 273b698304..7690094861 100644 --- a/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/instantiate-connection-factory/src/main/resources/activemq/server0/broker.xml @@ -39,7 +39,7 @@ under the License. - tcp://localhost:61617 + tcp://localhost:61616 diff --git a/examples/jms/interceptor/pom.xml b/examples/jms/interceptor/pom.xml index fe6708dc7e..5d7a2a0953 100644 --- a/examples/jms/interceptor/pom.xml +++ b/examples/jms/interceptor/pom.xml @@ -62,17 +62,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -83,16 +79,10 @@ under the License. org.apache.activemq.artemis.jms.example.InterceptorExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -100,41 +90,7 @@ under the License. artemis-jms-interceptor-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/jms-auto-closeable/pom.xml b/examples/jms/jms-auto-closeable/pom.xml index 7b2896d189..6cceae6798 100644 --- a/examples/jms/jms-auto-closeable/pom.xml +++ b/examples/jms/jms-auto-closeable/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.JMSAutoCloseableExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-auto-closeable-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/jms-bridge/pom.xml b/examples/jms/jms-bridge/pom.xml index ae0b7763db..54ea63e485 100644 --- a/examples/jms/jms-bridge/pom.xml +++ b/examples/jms/jms-bridge/pom.xml @@ -62,22 +62,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -88,33 +89,9 @@ under the License. org.apache.activemq.artemis.jms.example.JMSBridgeExample - tcp://localhost:61616 - tcp://localhost:5455 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -124,46 +101,7 @@ under the License. artemis-jms-jms-bridge-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java index d1168f5c81..659d37bcb0 100644 --- a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java +++ b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java @@ -16,14 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.jms.bridge.JMSBridge; -import org.apache.activemq.artemis.jms.bridge.QualityOfServiceMode; -import org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl; -import org.apache.activemq.artemis.jms.bridge.impl.JNDIConnectionFactoryFactory; -import org.apache.activemq.artemis.jms.bridge.impl.JNDIDestinationFactory; - -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -33,22 +25,32 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.naming.InitialContext; +import java.util.Hashtable; + +import org.apache.activemq.artemis.common.example.ActiveMQExample; +import org.apache.activemq.artemis.jms.bridge.JMSBridge; +import org.apache.activemq.artemis.jms.bridge.QualityOfServiceMode; +import org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl; +import org.apache.activemq.artemis.jms.bridge.impl.JNDIConnectionFactoryFactory; +import org.apache.activemq.artemis.jms.bridge.impl.JNDIDestinationFactory; /** * An example which sends a message to a source topic and consume from a target queue. * The source and target destinations are located on 2 different ActiveMQ Artemis server. * The source and target queues are bridged by a JMS Bridge configured and running on the "target" server. */ -public class JMSBridgeExample +public class JMSBridgeExample extends ActiveMQExample { public static void main(final String[] args) throws Exception { - if (args.length != 2) - { - throw new IllegalArgumentException("JMSBridgeExample needs 2 arguments: "); - } - String sourceServer = args[0]; - String targetServer = args[1]; + new JMSBridgeExample().run(args); + } + + @Override + public boolean runExample() throws Exception + { + String sourceServer = ActiveMQExample.DEFAULT_TCP1; + String targetServer = ActiveMQExample.DEFAULT_TCP2; System.out.println("client will publish messages to " + sourceServer + " and receives message from " + @@ -152,6 +154,8 @@ public class JMSBridgeExample targetConnection.close(); } } + + return true; } private static InitialContext createContext(final String server) throws Exception diff --git a/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml b/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml index a8802d3f69..aada805f2f 100644 --- a/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/jms-bridge/src/main/resources/activemq/server1/broker.xml @@ -38,6 +38,7 @@ under the License. tcp://localhost:5455 + tcp://localhost:61617 @@ -50,4 +51,4 @@ under the License. - + diff --git a/examples/jms/jms-completion-listener/pom.xml b/examples/jms/jms-completion-listener/pom.xml index d5fc035f8a..042b3de01f 100644 --- a/examples/jms/jms-completion-listener/pom.xml +++ b/examples/jms/jms-completion-listener/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.JMSCompletionListenerExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-completion-listener-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/jms-context/pom.xml b/examples/jms/jms-context/pom.xml index 55e8ab7f37..7363d880db 100644 --- a/examples/jms/jms-context/pom.xml +++ b/examples/jms/jms-context/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.JMSContextExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-context-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/jms-shared-consumer/pom.xml b/examples/jms/jms-shared-consumer/pom.xml index 71636ea6e3..5939114675 100644 --- a/examples/jms/jms-shared-consumer/pom.xml +++ b/examples/jms/jms-shared-consumer/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.JMSSharedConsumerExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,41 +85,7 @@ under the License. artemis-jms-shared-consumer-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/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java b/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java index 4fdbe961a8..5c50063ad9 100644 --- a/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java +++ b/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java @@ -16,13 +16,10 @@ */ package org.apache.activemq.artemis.jms.example; -import javax.jms.CompletionListener; import javax.jms.ConnectionFactory; import javax.jms.JMSConsumer; import javax.jms.JMSContext; import javax.jms.JMSProducer; -import javax.jms.Message; -import javax.jms.Queue; import javax.jms.Topic; import javax.naming.InitialContext; @@ -33,7 +30,7 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample; */ public class JMSSharedConsumerExample extends ActiveMQExample { - public static void main(final String[] args) + public static void main(final String[] args) throws Exception { new JMSSharedConsumerExample().run(args); } diff --git a/examples/jms/jmx/pom.xml b/examples/jms/jmx/pom.xml index 28082ae57e..f9a3e9abac 100644 --- a/examples/jms/jmx/pom.xml +++ b/examples/jms/jmx/pom.xml @@ -67,35 +67,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - true - - - data.dir - ${basedir}/target/ - - - com.sun.management.jmxremote - - - - com.sun.management.jmxremote.port - 3000 - - - com.sun.management.jmxremote.ssl - false - - - com.sun.management.jmxremote.authenticate - false - - + + -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false @@ -105,56 +83,19 @@ under the License. org.apache.activemq.artemis.jms.example.JMXExample + + ${basedir}/target/server0 + - - stop - - stop - - - + org.apache.activemq.examples.jms artemis-jms-jmx-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/large-message/pom.xml b/examples/jms/large-message/pom.xml index afba5661cf..dd3af5b953 100644 --- a/examples/jms/large-message/pom.xml +++ b/examples/jms/large-message/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,20 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.LargeMessageExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - + + ${basedir}/target/server0 + - - stop - - stop - - @@ -98,41 +85,7 @@ under the License. artemis-jms-large-message-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/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java b/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java index 30f339dfa0..d154ed73af 100644 --- a/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java +++ b/examples/jms/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java @@ -16,14 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - import javax.jms.BytesMessage; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -32,6 +24,13 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.naming.InitialContext; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import org.apache.activemq.artemis.common.example.ActiveMQExample; diff --git a/examples/jms/last-value-queue/pom.xml b/examples/jms/last-value-queue/pom.xml index 43b6fd5b5d..61f9b7b892 100644 --- a/examples/jms/last-value-queue/pom.xml +++ b/examples/jms/last-value-queue/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.LastValueQueueExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,42 +85,8 @@ under the License. artemis-jms-last-value-queue-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/management-notifications/pom.xml b/examples/jms/management-notifications/pom.xml index 12d3248409..9e023e062a 100644 --- a/examples/jms/management-notifications/pom.xml +++ b/examples/jms/management-notifications/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.ManagementNotificationExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,42 +85,8 @@ under the License. artemis-jms-management-notifications-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/management/pom.xml b/examples/jms/management/pom.xml index 4357e0fab9..1797ce188e 100644 --- a/examples/jms/management/pom.xml +++ b/examples/jms/management/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.ManagementExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-management-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/message-counters/pom.xml b/examples/jms/message-counters/pom.xml index 1c7ac18a1d..f4d8753f02 100644 --- a/examples/jms/message-counters/pom.xml +++ b/examples/jms/message-counters/pom.xml @@ -62,35 +62,15 @@ under the License. artemis-maven-plugin - start + create - start + create - - true - - - data.dir - ${basedir}/target/ - - - com.sun.management.jmxremote - - - - com.sun.management.jmxremote.port - 3001 - - - com.sun.management.jmxremote.ssl - false - - - com.sun.management.jmxremote.authenticate - false - - + ${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 @@ -100,14 +80,11 @@ under the License. org.apache.activemq.artemis.jms.example.MessageCounterExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -115,41 +92,7 @@ under the License. artemis-jms-message-counters-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/message-group/pom.xml b/examples/jms/message-group/pom.xml index 29410c751f..e2e6b145d7 100644 --- a/examples/jms/message-group/pom.xml +++ b/examples/jms/message-group/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.MessageGroupExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,42 +85,8 @@ under the License. artemis-jms-message-group-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/message-group2/pom.xml b/examples/jms/message-group2/pom.xml index a88c45c68b..54258f96b7 100644 --- a/examples/jms/message-group2/pom.xml +++ b/examples/jms/message-group2/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.MessageGroup2Example + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-message-group2-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/message-priority/pom.xml b/examples/jms/message-priority/pom.xml index 805380cc13..5b354733f1 100644 --- a/examples/jms/message-priority/pom.xml +++ b/examples/jms/message-priority/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.MessagePriorityExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-message-priority-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/multiple-failover-failback/pom.xml b/examples/jms/multiple-failover-failback/pom.xml index 62bb695f65..0e429b7f6e 100644 --- a/examples/jms/multiple-failover-failback/pom.xml +++ b/examples/jms/multiple-failover-failback/pom.xml @@ -57,62 +57,33 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create1 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 - start2 + create2 - start + create - ${basedir}/target/classes/activemq/server2 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server2 + ${basedir}/target/classes/activemq/server2 @@ -122,39 +93,11 @@ under the License. org.apache.activemq.artemis.jms.example.MultipleFailoverFailbackExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 + + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 + @@ -164,47 +107,8 @@ under the License. artemis-jms-multiple-failover-failback-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 - - - data.dir - ${basedir}/target/ - - - - + 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 d59e494481..9ea1dc9642 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 @@ -30,11 +30,22 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample; public class MultipleFailoverFailbackExample extends ActiveMQExample { - public static void main(final String[] args) + 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 { @@ -94,6 +105,7 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample // it has really crashed Thread.sleep(2000); killServer(0); + Thread.sleep(5000); // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the // backup server has occurred @@ -115,7 +127,7 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample message0.acknowledge(); Thread.sleep(2000); - reStartServer(0, 10000); + startServer(0, 10000); // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the // backup server has occurred 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 index 52eb917eda..4cf5582e6b 100644 --- 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 @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../server0/data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../server0/data/messaging/paging 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 index eb70455fff..f910045c84 100644 --- 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 @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../server0/data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../server0/data/messaging/paging 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 index dff08b3d9b..76a521a074 100644 --- 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 @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../server0/data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../server0/data/messaging/paging diff --git a/examples/jms/multiple-failover/pom.xml b/examples/jms/multiple-failover/pom.xml index 2bd00f87ff..a68679d947 100644 --- a/examples/jms/multiple-failover/pom.xml +++ b/examples/jms/multiple-failover/pom.xml @@ -57,62 +57,33 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create1 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 - start2 + create2 - start + create - ${basedir}/target/classes/activemq/server2 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server2 + ${basedir}/target/classes/activemq/server2 @@ -122,39 +93,11 @@ under the License. org.apache.activemq.artemis.jms.example.MultipleFailoverExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 + + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 + @@ -164,46 +107,7 @@ under the License. artemis-jms-multiple-failover-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 - - - data.dir - ${basedir}/target/ - - - 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 dfa54020f3..a2b55e4e7b 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 @@ -30,11 +30,22 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample; public class MultipleFailoverExample extends ActiveMQExample { - public static void main(final String[] args) + 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 { @@ -92,8 +103,9 @@ 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(2000); + Thread.sleep(1000); killServer(0); + Thread.sleep(5000); // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the // backup server has occurred @@ -114,8 +126,9 @@ public class MultipleFailoverExample extends ActiveMQExample } message0.acknowledge(); - Thread.sleep(2000); + Thread.sleep(1000); killServer(getServer(connection)); + Thread.sleep(5000); // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the // backup server has occurred 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 index ca23965f0f..323bfefa3a 100644 --- a/examples/jms/multiple-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/multiple-failover/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../server0/data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../server0/data/messaging/paging 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 index eb70455fff..f910045c84 100644 --- a/examples/jms/multiple-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/multiple-failover/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../server0/data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../server0/data/messaging/paging 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 index 482b4ced72..c114ed20c2 100644 --- a/examples/jms/multiple-failover/src/main/resources/activemq/server2/broker.xml +++ b/examples/jms/multiple-failover/src/main/resources/activemq/server2/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../server0/data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../server0/data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../server0/data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../server0/data/messaging/paging diff --git a/examples/jms/no-consumer-buffering/pom.xml b/examples/jms/no-consumer-buffering/pom.xml index 7373bb4c76..6e4818f46d 100644 --- a/examples/jms/no-consumer-buffering/pom.xml +++ b/examples/jms/no-consumer-buffering/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.NoConsumerBufferingExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-no-consumer-buffering-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/non-transaction-failover/pom.xml b/examples/jms/non-transaction-failover/pom.xml index d90c9d40ef..675dc23c5a 100644 --- a/examples/jms/non-transaction-failover/pom.xml +++ b/examples/jms/non-transaction-failover/pom.xml @@ -57,42 +57,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create1 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -102,30 +83,10 @@ under the License. org.apache.activemq.artemis.jms.example.NonTransactionFailoverExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 + + ${basedir}/target/server0 + ${basedir}/target/server1 + @@ -135,40 +96,7 @@ under the License. non-transaction-failover ${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 - + 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 021835e1ed..e690fd607e 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 @@ -34,11 +34,21 @@ import org.apache.activemq.artemis.common.example.ActiveMQExample; */ public class NonTransactionFailoverExample extends ActiveMQExample { - public static void main(final String[] args) + 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 { @@ -98,6 +108,7 @@ public class NonTransactionFailoverExample extends ActiveMQExample // pending Acks are on the server's side Thread.sleep(2000); killServer(0); + Thread.sleep(5000); // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the // backup server has occurred 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 index 1a5bc0b768..00e724b433 100644 --- 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 @@ -71,10 +71,10 @@ under the License. - target/server0/data/large-messages - target/server0/data/bindings - target/server0/data/journal - target/server0/data/paging + ../../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/broker.xml b/examples/jms/non-transaction-failover/src/main/resources/activemq/server1/broker.xml index ecb5cdaabd..0406b8fad9 100644 --- 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 @@ -71,10 +71,10 @@ under the License. - target/server0/data/large-messages - target/server0/data/bindings - target/server0/data/journal - target/server0/data/paging + ../../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 2de0c1d5e7..1ee5cfc6e2 100644 --- a/examples/jms/openwire/pom.xml +++ b/examples/jms/openwire/pom.xml @@ -45,17 +45,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -65,14 +61,11 @@ under the License. org.apache.activemq.artemis.jms.example.OpenWireExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -80,46 +73,7 @@ under the License. artemis-jms-openwire-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} - - - org.apache.activemq - artemis-openwire-protocol - ${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/openwire/src/main/resources/activemq/server0/broker.xml b/examples/jms/openwire/src/main/resources/activemq/server0/broker.xml index dbb0ca60e8..c281c605b4 100644 --- a/examples/jms/openwire/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/openwire/src/main/resources/activemq/server0/broker.xml @@ -43,7 +43,9 @@ under the License. - tcp://localhost:61616?protocols=OPENWIRE + + tcp://localhost:61616?protocols=OPENWIRE,CORE diff --git a/examples/jms/paging/pom.xml b/examples/jms/paging/pom.xml index a0251a0446..83103edf98 100644 --- a/examples/jms/paging/pom.xml +++ b/examples/jms/paging/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.PagingExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-paging-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/perf/pom.xml b/examples/jms/perf/pom.xml index 07e341080f..2db189aa17 100644 --- a/examples/jms/perf/pom.xml +++ b/examples/jms/perf/pom.xml @@ -70,65 +70,37 @@ under the License. org.apache.activemq artemis-maven-plugin - - - start - - start - - - true - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - - - - - false - ${basedir}/target/classes/activemq/server0 - - - - org.apache.activemq.examples.jms - artemis-jms-perf-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} - - + + + create + + create + + + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + + + + runClient + + runClient + + + org.apache.activemq.artemis.jms.example.Server + + ${basedir}/target/server0 + + + + + + + org.apache.activemq.examples.jms + artemis-jms-perf-example + ${project.version} + + diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManagerMBean.java b/examples/jms/perf/src/main/java/org/apache/activemq/artemis/jms/example/Server.java similarity index 64% rename from artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManagerMBean.java rename to examples/jms/perf/src/main/java/org/apache/activemq/artemis/jms/example/Server.java index 50b3e8f567..d844c40340 100644 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/TestClusterManagerMBean.java +++ b/examples/jms/perf/src/main/java/org/apache/activemq/artemis/jms/example/Server.java @@ -14,16 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.maven; -import java.io.IOException; +package org.apache.activemq.artemis.jms.example; -public interface TestClusterManagerMBean +public class Server { - int getNumNodes(); - - void registerNode(String nodeId, String workingDir, - String hornetqConfigurationDirt); - - void killNode(int i) throws IOException; + public static void main(String arg[]) + { + System.out.println("***********************************************************************************"); + System.out.println("You need to start manually under ./target/server/bin just run ./artemis run"); + System.out.println("***********************************************************************************"); + } } diff --git a/examples/jms/perf/src/main/resources/perf.properties b/examples/jms/perf/src/main/resources/perf.properties index 8dbf02a364..5f6f975edf 100644 --- a/examples/jms/perf/src/main/resources/perf.properties +++ b/examples/jms/perf/src/main/resources/perf.properties @@ -15,10 +15,10 @@ # specific language governing permissions and limitations # under the License. -num-messages=1 -num-warmup-messages=0 +num-messages=100000 +num-warmup-messages=1000 message-size=1024 -durable=true +durable=false transacted=false batch-size=1000 drain-queue=false diff --git a/examples/jms/pre-acknowledge/pom.xml b/examples/jms/pre-acknowledge/pom.xml index d644d80dbd..030d77fc86 100644 --- a/examples/jms/pre-acknowledge/pom.xml +++ b/examples/jms/pre-acknowledge/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.PreacknowledgeExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,41 +85,7 @@ under the License. artemis-jms-pre-acknowledge-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/producer-rate-limit/pom.xml b/examples/jms/producer-rate-limit/pom.xml index 2b2dbe05fd..535a7d562d 100644 --- a/examples/jms/producer-rate-limit/pom.xml +++ b/examples/jms/producer-rate-limit/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.ProducerRateLimitExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-producer-rate-limit-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/proton-cpp/pom.xml b/examples/jms/proton-cpp/pom.xml index 9422c83d2b..c5e41a4d66 100644 --- a/examples/jms/proton-cpp/pom.xml +++ b/examples/jms/proton-cpp/pom.xml @@ -55,20 +55,15 @@ under the License. org.apache.activemq artemis-maven-plugin - ${project.version} - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.ProtonCPPExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -93,46 +85,7 @@ under the License. artemis-jms-protoncpp ${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} - - - org.apache.activemq - artemis-amqp-protocol - ${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/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 df4503e95d..b23dc55127 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 @@ -26,13 +26,10 @@ import javax.jms.QueueConnection; import javax.jms.QueueRequestor; import javax.jms.QueueSession; import javax.jms.Session; -import javax.jms.TextMessage; 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; /** diff --git a/examples/jms/proton-j/pom.xml b/examples/jms/proton-j/pom.xml index 42e9ea9f89..3001867f21 100644 --- a/examples/jms/proton-j/pom.xml +++ b/examples/jms/proton-j/pom.xml @@ -58,17 +58,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -79,16 +75,10 @@ under the License. org.apache.activemq.artemis.jms.example.ProtonJExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -96,46 +86,7 @@ under the License. artemis-proton-j-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} - - - org.apache.activemq - artemis-amqp-protocol - ${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/proton-j/src/main/resources/activemq/server0/broker.xml b/examples/jms/proton-j/src/main/resources/activemq/server0/broker.xml index c27781de3d..f1df1c6a9e 100644 --- a/examples/jms/proton-j/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/proton-j/src/main/resources/activemq/server0/broker.xml @@ -41,6 +41,7 @@ under the License. tcp://localhost:5672 + tcp://localhost:61616 diff --git a/examples/jms/proton-ruby/pom.xml b/examples/jms/proton-ruby/pom.xml index 6db85cdc46..b00e3086d7 100644 --- a/examples/jms/proton-ruby/pom.xml +++ b/examples/jms/proton-ruby/pom.xml @@ -53,18 +53,13 @@ under the License. artemis-maven-plugin - start + create - start + create - true - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -74,46 +69,7 @@ under the License. artemis-jms-proton-ruby-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} - - - org.apache.activemq - artemis-amqp-protocol - ${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/proton-ruby/readme.html b/examples/jms/proton-ruby/readme.html index 0277e7bc47..951a654fd9 100644 --- a/examples/jms/proton-ruby/readme.html +++ b/examples/jms/proton-ruby/readme.html @@ -42,7 +42,8 @@ under the License.

Example step-by-step

-

Firstly start the server by running the command mvn verify -Pexample

+

Firstly create the server by running the command mvn verify -Pexample

+

Start the server manually under ./target/server1/bin by calling ./artemis run

Then in a separate window you can run the send ruby script by running the command ruby src/main/scripts/send.rb

You can then receive the message via the receive ruby script by running ruby src/main/scripts/receive.rb

diff --git a/examples/jms/queue-message-redistribution/pom.xml b/examples/jms/queue-message-redistribution/pom.xml index f8448d6961..c54657c387 100644 --- a/examples/jms/queue-message-redistribution/pom.xml +++ b/examples/jms/queue-message-redistribution/pom.xml @@ -57,42 +57,23 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 @@ -103,33 +84,9 @@ under the License. org.apache.activemq.artemis.jms.example.QueueMessageRedistributionExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -139,46 +96,7 @@ under the License. artemis-jms-queue-message-redistribution-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 - - - data.dir - ${basedir}/target/ - - - 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 fc5ef2c2c1..a1d0a8f143 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 @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -58,7 +57,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", args[0]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1); properties.put("queue.queue/exampleQueue", "exampleQueue"); ic0 = new InitialContext(properties); @@ -71,7 +70,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", args[1]); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2); ic1 = new InitialContext(properties); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 diff --git a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/queue-message-redistribution/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-message-redistribution/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/queue-message-redistribution/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-message-redistribution/src/main/resources/activemq/server1/artemis-roles.properties b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/queue-message-redistribution/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/queue-message-redistribution/src/main/resources/activemq/server1/artemis-users.properties b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/queue-message-redistribution/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/queue-requestor/pom.xml b/examples/jms/queue-requestor/pom.xml index 9ab5b2d526..893aef7ce9 100644 --- a/examples/jms/queue-requestor/pom.xml +++ b/examples/jms/queue-requestor/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.QueueRequestorExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-queue-requestor-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/queue-selector/pom.xml b/examples/jms/queue-selector/pom.xml index fb7bd90319..8ccd41ced9 100644 --- a/examples/jms/queue-selector/pom.xml +++ b/examples/jms/queue-selector/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.QueueSelectorExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-queue-selector-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/queue/pom.xml b/examples/jms/queue/pom.xml index 23a178804e..9619a7f044 100644 --- a/examples/jms/queue/pom.xml +++ b/examples/jms/queue/pom.xml @@ -55,20 +55,15 @@ under the License. org.apache.activemq artemis-maven-plugin - ${project.version} - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + @@ -78,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.QueueExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -93,41 +85,7 @@ under the License. artemis-jms-queue-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/queue/readme.html b/examples/jms/queue/readme.html index 788f9b75e9..a80d9739a2 100644 --- a/examples/jms/queue/readme.html +++ b/examples/jms/queue/readme.html @@ -30,6 +30,7 @@ under the License.

This example shows you how to send and receive a message to a JMS Queue using ActiveMQ Artemis.

Queues are a standard part of JMS, please consult the JMS 1.1 specification for full details.

A Queue is used to send messages point to point, from a producer to a consumer. The queue guarantees message ordering between these 2 points.

+

Notice this example is using pretty much a default stock configuration

Example step-by-step

To run the example, simply type mvn verify -Pexample from this directory

diff --git a/examples/jms/queue/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/queue/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/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/queue/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/queue/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44cec4..0000000000 --- a/examples/jms/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/queue/src/main/resources/activemq/server0/broker.xml b/examples/jms/queue/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 7690094861..0000000000 --- a/examples/jms/queue/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/reattach-node/pom.xml b/examples/jms/reattach-node/pom.xml index 4cf1c93c0f..76ae5d7eb3 100644 --- a/examples/jms/reattach-node/pom.xml +++ b/examples/jms/reattach-node/pom.xml @@ -57,12 +57,13 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -72,21 +73,9 @@ under the License. org.apache.activemq.artemis.jms.example.ReattachExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 + + ${basedir}/target/server0 + @@ -96,46 +85,7 @@ under the License. artemis-jms-reattach-node-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/replicated-failback-static/pom.xml b/examples/jms/replicated-failback-static/pom.xml index 9b0a522738..9a9a2f73f5 100644 --- a/examples/jms/replicated-failback-static/pom.xml +++ b/examples/jms/replicated-failback-static/pom.xml @@ -57,42 +57,25 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} @@ -102,30 +85,10 @@ under the License. org.apache.activemq.artemis.jms.example.ReplicatedFailbackStaticExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 + + ${basedir}/target/server0 + ${basedir}/target/server1 + @@ -135,46 +98,7 @@ under the License. artemis-jms-replicated-failback-static-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/replicated-failback/pom.xml b/examples/jms/replicated-failback/pom.xml index 005ce5382d..7a27d383bb 100644 --- a/examples/jms/replicated-failback/pom.xml +++ b/examples/jms/replicated-failback/pom.xml @@ -57,42 +57,25 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} @@ -102,30 +85,10 @@ under the License. org.apache.activemq.artemis.jms.example.ReplicatedFailbackExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 + + ${basedir}/target/server0 + ${basedir}/target/server1 + @@ -135,46 +98,7 @@ under the License. artemis-jms-replicated-failback-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 - - - data.dir - ${basedir}/target/ - - - 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 6bf2b016df..02fcbaf288 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 @@ -42,6 +42,12 @@ public class ReplicatedFailbackExample extends ActiveMQExample new ReplicatedFailbackExample().run(args); } + protected void startServers(String[] serversArgs) throws Exception + { + startServer(0, 60000); + startServer(1, 10000); + } + @Override public boolean runExample() throws Exception { 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 8a933506f2..e762e2c92c 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}/server0/data/messaging/bindings + ${data.dir}/live/bindings - ${data.dir}/server0/data/messaging/journal + ${data.dir}/live/journal - ${data.dir}/server0/data/messaging/largemessages + ${data.dir}/live/largemessages - ${data.dir}/server0/data/messaging/paging + ${data.dir}/live/paging exampleUser @@ -72,7 +72,7 @@ under the License. ${udp-address:231.7.7.7} 9876 - 60000 + 5000 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 eec921f25c..af242b9d12 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}/server1/data/messaging/bindings + ${data.dir}/bkp/bindings - ${data.dir}/server1/data/messaging/journal + ${data.dir}/bkp/journal - ${data.dir}/server1/data/messaging/largemessages + ${data.dir}/bkp/largemessages - ${data.dir}/server1/data/messaging/paging + ${data.dir}/bkp/paging exampleUser @@ -73,7 +73,7 @@ under the License. ${udp-address:231.7.7.7} 9876 - 60000 + 5000 diff --git a/examples/jms/replicated-multiple-failover/pom.xml b/examples/jms/replicated-multiple-failover/pom.xml index 90ed9e9a03..60ba4a6532 100644 --- a/examples/jms/replicated-multiple-failover/pom.xml +++ b/examples/jms/replicated-multiple-failover/pom.xml @@ -57,62 +57,25 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - - - - - start2 - - start - - - ${basedir}/target/classes/activemq/server2 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} @@ -122,39 +85,10 @@ under the License. org.apache.activemq.artemis.jms.example.ReplicatedMultipleFailoverExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 + + ${basedir}/target/server0 + ${basedir}/target/server1 + @@ -164,46 +98,7 @@ under the License. artemis-jms-replicated-multiple-failover-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/replicated-transaction-failover/pom.xml b/examples/jms/replicated-transaction-failover/pom.xml index f64eec3d52..b6def6610e 100644 --- a/examples/jms/replicated-transaction-failover/pom.xml +++ b/examples/jms/replicated-transaction-failover/pom.xml @@ -57,42 +57,25 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - - true + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} @@ -102,30 +85,10 @@ under the License. org.apache.activemq.artemis.jms.example.ReplicatedTransactionFailoverExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 + + ${basedir}/target/server0 + ${basedir}/target/server1 + @@ -135,46 +98,7 @@ under the License. artemis-jms-replicated-transaction-failover-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/request-reply/pom.xml b/examples/jms/request-reply/pom.xml index 9610f67ae8..5880d9d8fc 100644 --- a/examples/jms/request-reply/pom.xml +++ b/examples/jms/request-reply/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.RequestReplyExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-request-reply-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/scale-down/pom.xml b/examples/jms/scale-down/pom.xml index 3d8f617982..5a1cd36585 100644 --- a/examples/jms/scale-down/pom.xml +++ b/examples/jms/scale-down/pom.xml @@ -57,34 +57,25 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} @@ -95,33 +86,9 @@ under the License. org.apache.activemq.artemis.jms.example.ScaleDownExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -131,40 +98,7 @@ under the License. scale-down ${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 - 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 5ee9701255..f3704911de 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,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Hashtable; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -26,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.Hashtable; import org.apache.activemq.artemis.common.example.ActiveMQExample; @@ -56,13 +55,13 @@ public class ScaleDownExample extends ActiveMQExample // 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", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP1 + "?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", args[1] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); + properties.put("connectionFactory.ConnectionFactory", DEFAULT_TCP2 + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); initialContext1 = new InitialContext(properties); // Step 2. Look up the JMS resources from JNDI @@ -97,6 +96,7 @@ public class ScaleDownExample extends ActiveMQExample // it has really crashed Thread.sleep(5000); killServer(1); + Thread.sleep(5000); // Step 8. start the connection ready to receive messages 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 33de64fe87..b2e18876fc 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 @@ -30,13 +30,13 @@ under the License. - target/server0/data/messaging/bindings + ${data.dir:../data}/bindings - target/server0/data/messaging/journal + ${data.dir:../data}/journal - target/server0/data/messaging/largemessages + ${data.dir:../data}/largemessages - target/server0/data/messaging/paging + ${data.dir:../data}/paging 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 7602ef9529..e198399b0e 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 @@ -30,13 +30,13 @@ under the License. - target/server1/data/messaging/bindings + ${data.dir:../data}/bindings - target/server1/data/messaging/journal + ${data.dir:../data}/journal - target/server1/data/messaging/largemessages + ${data.dir:../data}/largemessages - target/server1/data/messaging/paging + ${data.dir:../data}/paging diff --git a/examples/jms/scheduled-message/pom.xml b/examples/jms/scheduled-message/pom.xml index cbd96ffa12..676e5573f0 100644 --- a/examples/jms/scheduled-message/pom.xml +++ b/examples/jms/scheduled-message/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.ScheduledMessageExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-scheduled-message-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/security/pom.xml b/examples/jms/security/pom.xml index 66388a57a3..88330b12a0 100644 --- a/examples/jms/security/pom.xml +++ b/examples/jms/security/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.SecurityExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-security-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/send-acknowledgements/pom.xml b/examples/jms/send-acknowledgements/pom.xml index 165e9a9443..7aa59cf24a 100644 --- a/examples/jms/send-acknowledgements/pom.xml +++ b/examples/jms/send-acknowledgements/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.SendAcknowledgementsExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-send-acknowledgements-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/spring-integration/pom.xml b/examples/jms/spring-integration/pom.xml index b021c57d12..25ae488804 100644 --- a/examples/jms/spring-integration/pom.xml +++ b/examples/jms/spring-integration/pom.xml @@ -72,6 +72,9 @@ under the License. org.apache.activemq.artemis.jms.example.SpringExample + + ${basedir}/target/server0 + @@ -81,41 +84,7 @@ under the License. artemis-jms-spring-integration-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/ssl-enabled/pom.xml b/examples/jms/ssl-enabled/pom.xml index 4c80ebac34..47989bf0f5 100644 --- a/examples/jms/ssl-enabled/pom.xml +++ b/examples/jms/ssl-enabled/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.SSLExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-ssl-enabled-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/static-selector-jms/pom.xml b/examples/jms/static-selector-jms/pom.xml index 5e2855daec..750af0002f 100644 --- a/examples/jms/static-selector-jms/pom.xml +++ b/examples/jms/static-selector-jms/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -78,16 +74,10 @@ under the License. org.apache.activemq.artemis.jms.example.StaticSelectorJMSExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -95,41 +85,7 @@ under the License. artemis-jms-static-selector-jms-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/static-selector/pom.xml b/examples/jms/static-selector/pom.xml index 19f8e80745..cf08771d58 100644 --- a/examples/jms/static-selector/pom.xml +++ b/examples/jms/static-selector/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.StaticSelectorExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-static-selector-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/stomp-websockets/pom.xml b/examples/jms/stomp-websockets/pom.xml index 49710ca681..d64b66dccb 100644 --- a/examples/jms/stomp-websockets/pom.xml +++ b/examples/jms/stomp-websockets/pom.xml @@ -57,12 +57,13 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -73,23 +74,8 @@ under the License. org.apache.activemq.artemis.jms.example.StompWebSocketExample - tcp://localhost:61616 + ${basedir}/target/server0 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 @@ -99,51 +85,7 @@ under the License. artemis-jms-stomp-websockets-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} - - - org.apache.activemq - artemis-stomp-protocol - ${project.version} - - - io.netty - netty-all - ${netty.version} - - - org.apache.geronimo.specs - geronimo-jms_2.0_spec - ${geronimo.jms.2.spec.version} - - - false - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/stomp/pom.xml b/examples/jms/stomp/pom.xml index d7276f5c4e..809e433ee5 100644 --- a/examples/jms/stomp/pom.xml +++ b/examples/jms/stomp/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.StompExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,46 +85,7 @@ under the License. artemis-jms-stomp-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} - - - org.apache.activemq - artemis-stomp-protocol - ${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/stomp1.1/pom.xml b/examples/jms/stomp1.1/pom.xml index 0ac5dbd96c..14e9a76483 100644 --- a/examples/jms/stomp1.1/pom.xml +++ b/examples/jms/stomp1.1/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.StompExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,46 +85,7 @@ under the License. artemis-jms-stomp1.1-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-stomp-protocol - ${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/stomp1.2/pom.xml b/examples/jms/stomp1.2/pom.xml index c2f8b36b6d..c696d8b737 100644 --- a/examples/jms/stomp1.2/pom.xml +++ b/examples/jms/stomp1.2/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.StompExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,46 +85,7 @@ under the License. artemis-jms-stomp1.2-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} - - - org.apache.activemq - artemis-stomp-protocol - ${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/stop-server-failover/pom.xml b/examples/jms/stop-server-failover/pom.xml index 04033af15d..e1ebe90313 100644 --- a/examples/jms/stop-server-failover/pom.xml +++ b/examples/jms/stop-server-failover/pom.xml @@ -57,42 +57,25 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} @@ -103,33 +86,9 @@ under the License. org.apache.activemq.artemis.jms.example.StopServerFailoverExample - tcp://localhost:61616 - tcp://localhost:61617 + ${basedir}/target/server0 + ${basedir}/target/server1 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 @@ -139,46 +98,7 @@ under the License. artemis-jms-stop-server-failover-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 - - - data.dir - ${basedir}/target/ - - - diff --git a/examples/jms/symmetric-cluster/pom.xml b/examples/jms/symmetric-cluster/pom.xml index 6da292ce85..a7d35f7a2d 100644 --- a/examples/jms/symmetric-cluster/pom.xml +++ b/examples/jms/symmetric-cluster/pom.xml @@ -57,124 +57,72 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create1 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} - start2 + create2 - start + create - ${basedir}/target/classes/activemq/server2 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server2 + ${basedir}/target/classes/activemq/server2 + -Dudp-address=${udp-address} - start3 + create3 - start + create - ${basedir}/target/classes/activemq/server3 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server3 + ${basedir}/target/classes/activemq/server3 + -Dudp-address=${udp-address} - start4 + create4 - start + create - ${basedir}/target/classes/activemq/server4 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server4 + ${basedir}/target/classes/activemq/server4 + -Dudp-address=${udp-address} - start5 + create5 - start + create - ${basedir}/target/classes/activemq/server5 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server5 + ${basedir}/target/classes/activemq/server5 + -Dudp-address=${udp-address} + runClient @@ -183,73 +131,13 @@ under the License. org.apache.activemq.artemis.jms.example.SymmetricClusterExample - tcp://localhost:61616 - tcp://localhost:61617 - tcp://localhost:61618 - tcp://localhost:61619 - tcp://localhost:61620 - tcp://localhost:5450 + ${basedir}/target/server0 + ${basedir}/target/server1 + ${basedir}/target/server2 + ${basedir}/target/server3 + ${basedir}/target/server4 + ${basedir}/target/server5 - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 - - - - stop2 - - stop - - - ${basedir}/target/classes/activemq/server2 - - - - stop3 - - stop - - - ${basedir}/target/classes/activemq/server3 - - - - stop4 - - stop - - - ${basedir}/target/classes/activemq/server4 - - - - stop5 - - stop - - - ${basedir}/target/classes/activemq/server5 @@ -259,46 +147,7 @@ under the License. artemis-jms-symmetric-cluster-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 - - - data.dir - ${basedir}/target/ - - - 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 c17c5cda40..24e75f0534 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 @@ -232,12 +232,12 @@ public class SymmetricClusterExample extends ActiveMQExample { // Step 15. Be sure to close our resources! - closeConnection(connection0); - closeConnection(connection1); - closeConnection(connection2); - closeConnection(connection3); - closeConnection(connection4); - closeConnection(connection5); + connection0.close(); + connection1.close(); + connection2.close(); + connection3.close(); + connection4.close(); + connection5.close(); } } } diff --git a/examples/jms/temp-queue/pom.xml b/examples/jms/temp-queue/pom.xml index 6f47781ce6..b21308895f 100644 --- a/examples/jms/temp-queue/pom.xml +++ b/examples/jms/temp-queue/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.TemporaryQueueExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-temp-queue-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/topic-hierarchies/pom.xml b/examples/jms/topic-hierarchies/pom.xml index 388f63f026..087570e730 100644 --- a/examples/jms/topic-hierarchies/pom.xml +++ b/examples/jms/topic-hierarchies/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.TopicHierarchyExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-topic-hierarchies-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/topic-selector-example1/pom.xml b/examples/jms/topic-selector-example1/pom.xml index 7b5cafbedd..7526dd53d4 100644 --- a/examples/jms/topic-selector-example1/pom.xml +++ b/examples/jms/topic-selector-example1/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.TopicSelectorExample1 + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-topic-selector-example1-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/topic-selector-example2/pom.xml b/examples/jms/topic-selector-example2/pom.xml index dab3620add..320d13ce61 100644 --- a/examples/jms/topic-selector-example2/pom.xml +++ b/examples/jms/topic-selector-example2/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.TopicSelectorExample2 + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-topic-selector-example2-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/topic/pom.xml b/examples/jms/topic/pom.xml index 356300989e..0fe39ff25a 100644 --- a/examples/jms/topic/pom.xml +++ b/examples/jms/topic/pom.xml @@ -56,17 +56,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,16 +73,10 @@ under the License. org.apache.activemq.artemis.jms.example.TopicExample - tcp://localhost:61616 + ${basedir}/target/server0 - - stop - - stop - - @@ -94,41 +84,7 @@ under the License. artemis-jms-topic-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/transaction-failover/pom.xml b/examples/jms/transaction-failover/pom.xml index d61bcd85a3..f9544780f5 100644 --- a/examples/jms/transaction-failover/pom.xml +++ b/examples/jms/transaction-failover/pom.xml @@ -57,42 +57,25 @@ under the License. artemis-maven-plugin - start0 + create - start + create - ${basedir}/target/classes/activemq/server0 - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 + -Dudp-address=${udp-address} - start1 + create2 - start + create - ${basedir}/target/classes/activemq/server1 - true - - - data.dir - ${basedir}/target/ - - - udp-address - ${udp-address} - - + ${basedir}/target/server1 + ${basedir}/target/classes/activemq/server1 + -Dudp-address=${udp-address} @@ -102,30 +85,10 @@ under the License. org.apache.activemq.artemis.jms.example.TransactionFailoverExample - - - exampleConfigDir - ${basedir}/target/classes/activemq - - - - - - stop0 - - stop - - - ${basedir}/target/classes/activemq/server0 - - - - stop1 - - stop - - - ${basedir}/target/classes/activemq/server1 + + ${basedir}/target/server0 + ${basedir}/target/server1 + @@ -135,46 +98,7 @@ under the License. artemis-jms-transaction-failover-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 - - - data.dir - ${basedir}/target/ - - - 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 1041acadc2..74a66d4cb5 100644 --- a/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/transaction-failover/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../data/messaging/paging 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 27f33f6365..62e5154432 100644 --- a/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/transaction-failover/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir}/server0/data/messaging/bindings + ../../data/messaging/bindings - ${data.dir}/server0/data/messaging/journal + ../../data/messaging/journal - ${data.dir}/server0/data/messaging/largemessages + ../../data/messaging/largemessages - ${data.dir}/server0/data/messaging/paging + ../../data/messaging/paging diff --git a/examples/jms/transactional/pom.xml b/examples/jms/transactional/pom.xml index e7a629b4e2..7461ed67d8 100644 --- a/examples/jms/transactional/pom.xml +++ b/examples/jms/transactional/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -77,14 +73,11 @@ under the License. org.apache.activemq.artemis.jms.example.TransactionalExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,41 +85,7 @@ under the License. artemis-jms-transactional-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-heuristic/pom.xml b/examples/jms/xa-heuristic/pom.xml index 125bee72e7..da401e3ec9 100644 --- a/examples/jms/xa-heuristic/pom.xml +++ b/examples/jms/xa-heuristic/pom.xml @@ -57,35 +57,14 @@ under the License. artemis-maven-plugin - start + create - start + create - - true - - - com.sun.management.jmxremote - - - - com.sun.management.jmxremote.port - 3001 - - - com.sun.management.jmxremote.ssl - false - - - com.sun.management.jmxremote.authenticate - false - - - data.dir - ${basedir}/target/ - - + ${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 @@ -95,14 +74,11 @@ under the License. org.apache.activemq.artemis.jms.example.XAHeuristicExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -110,45 +86,11 @@ under the License. artemis-jms-xa-heuristic-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-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 0cacdb29cf..09232e3009 100644 --- a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java +++ b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java @@ -16,10 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; - import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; @@ -39,10 +35,13 @@ import javax.management.remote.JMXServiceURL; import javax.naming.InitialContext; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; -import org.apache.activemq.artemis.common.example.DummyXid; import org.apache.activemq.artemis.common.example.ActiveMQExample; +import org.apache.activemq.artemis.common.example.DummyXid; import org.apache.activemq.artemis.utils.UUIDGenerator; /** @@ -104,8 +103,7 @@ public class XAHeuristicExample extends ActiveMQExample TextMessage worldMessage = session.createTextMessage("world"); // Step 12. create a transaction - Xid xid1 = - new DummyXid("xa-example1".getBytes(StandardCharsets.ISO_8859_1), 1, UUIDGenerator.getInstance() + Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.ISO_8859_1), 1, UUIDGenerator.getInstance() .generateStringUUID() .getBytes()); diff --git a/examples/jms/xa-receive/pom.xml b/examples/jms/xa-receive/pom.xml index b3d6c6e32c..5fa068a6fd 100644 --- a/examples/jms/xa-receive/pom.xml +++ b/examples/jms/xa-receive/pom.xml @@ -57,17 +57,13 @@ under the License. artemis-maven-plugin - start + create - start + create - - - data.dir - ${basedir}/target/ - - + ${basedir}/target/server0 + ${basedir}/target/classes/activemq/server0 @@ -76,15 +72,12 @@ under the License. runClient - org.apache.activemq.artemis.jms.example.XAReceiveExample + org.apache.activemq.artemis.jms.example.TransactionalExample + + ${basedir}/target/server0 + - - stop - - stop - - @@ -92,45 +85,12 @@ under the License. artemis-jms-xa-receive-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-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 b624081e49..2671e54682 100644 --- a/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java +++ b/examples/jms/xa-receive/src/main/java/org/apache/activemq/artemis/jms/example/XAReceiveExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.nio.charset.StandardCharsets; - import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; @@ -29,9 +27,12 @@ import javax.jms.XASession; import javax.naming.InitialContext; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; +import java.nio.charset.StandardCharsets; -import org.apache.activemq.artemis.common.example.DummyXid; import org.apache.activemq.artemis.common.example.ActiveMQExample; + +// Defined on xa-heuristic example, the maven dependency will take care of that +import org.apache.activemq.artemis.common.example.DummyXid; import org.apache.activemq.artemis.utils.UUIDGenerator; /** @@ -88,8 +89,7 @@ public class XAReceiveExample extends ActiveMQExample TextMessage worldMessage = session.createTextMessage("world"); // Step 12. create a transaction - Xid xid1 = - new DummyXid("xa-example1".getBytes(StandardCharsets.US_ASCII), 1, UUIDGenerator.getInstance() + Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.US_ASCII), 1, UUIDGenerator.getInstance() .generateStringUUID() .getBytes()); 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 556fb1282d..447fbc49f0 100644 --- a/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java +++ b/examples/jms/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; - import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; @@ -33,9 +30,11 @@ import javax.jms.XASession; import javax.naming.InitialContext; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; -import org.apache.activemq.artemis.common.example.DummyXid; import org.apache.activemq.artemis.common.example.ActiveMQExample; +import org.apache.activemq.artemis.common.example.DummyXid; import org.apache.activemq.artemis.utils.UUIDGenerator; /** @@ -95,8 +94,7 @@ public class XASendExample extends ActiveMQExample TextMessage worldMessage = session.createTextMessage("world"); // Step 12. create a transaction - Xid xid1 = - new DummyXid("xa-example1".getBytes(StandardCharsets.UTF_8), 1, UUIDGenerator.getInstance() + Xid xid1 = new DummyXid("xa-example1".getBytes(StandardCharsets.UTF_8), 1, UUIDGenerator.getInstance() .generateStringUUID() .getBytes()); diff --git a/examples/soak/normal/README b/examples/soak/normal/README index 54ec245329..b69a1acf14 100644 --- a/examples/soak/normal/README +++ b/examples/soak/normal/README @@ -5,22 +5,18 @@ Running the Soak Tests ======================= -The default soak tests with start a ActiveMQ Artemis instance, 1 producer and 1 consumer. To run the default suite. - - $mvn verify - Run The Server Standalone ========================== -If would like to run a number of servers or run the server on a different machine: +Use the Profile server + mvn -Pserver verify -To run server using the default configuration (server0, using localhost): - $ mvn verify -Pserver +That will create a server under ./target/server0 -To run multiple servers, you can specify the server configuration directory using server.dir -system property (which defaults to server0). To run a 2nd server with a configuration stored in server1: - $ mvn verify -Pserver -Dserver.dir=server1 +You can define the property server.dir under the same Profile to create other servers. or you could do it manually if desired using the regular ./artemis create + + $ mvn -Dserver.dir=server1 -Pserver verify server1 should contain a copy of configuration equivalent to that found under the server0 director with different settings. @@ -32,6 +28,9 @@ change: $ mvn verify -P server + +To run the server just start it manually + Configure Server Dump ===================== @@ -61,7 +60,7 @@ The clients can be run separate from the server using: Parameters are specified in soak.properties. -The duration of the tests is configured by duration-in-minutes (defaults to 2 minutes, set to +The duration of the tests is configured by duration-in-minutes (defaults to 2 minutes, set to -1 to run the test indefinitely). To configure the soak properties different to the defaults for the clients, use the system property diff --git a/examples/soak/normal/pom.xml b/examples/soak/normal/pom.xml index e35be5a403..61d7866e2b 100644 --- a/examples/soak/normal/pom.xml +++ b/examples/soak/normal/pom.xml @@ -44,47 +44,37 @@ under the License. ${project.basedir}/../../.. - - - - org.apache.activemq - artemis-maven-plugin - - - org.apache.activemq.example.soak - artemis-jms-soak-example - ${project.version} - - - org.apache.activemq - artemis-server - ${project.version} - - - org.apache.activemq - artemis-jms-server - ${project.version} - - - io.netty - netty-all - ${netty.version} - - - - false - - - build.directory - ${basedir}/target/ - - - - - - - + + server + + + + org.apache.activemq + artemis-maven-plugin + + + create + + create + + + ${basedir}/target/server0 + ${basedir}/server0 + + + + + + org.apache.activemq.examples.soak + artemis-jms-soak-example + ${project.version} + + + + + + local @@ -93,16 +83,6 @@ under the License. org.apache.activemq artemis-maven-plugin - - start - - start - - - true - ${server.dir} - - runConsumer @@ -110,9 +90,6 @@ under the License. org.apache.activemq.artemis.jms.soak.example.SoakReceiver - - tcp://localhost:61616 - @@ -122,21 +99,16 @@ under the License. org.apache.activemq.artemis.jms.soak.example.SoakSender - - tcp://localhost:61616 - - - - - stop - - stop - - - ${server.dir} + + + org.apache.activemq.examples.soak + artemis-jms-soak-example + ${project.version} + + @@ -174,34 +146,17 @@ under the License. + + + org.apache.activemq.example.soak + artemis-jms-soak-example + ${project.version} + + - - server - - - - org.apache.activemq - artemis-maven-plugin - - - start - - start - - - ${server.dir} - true - true - - - - - - - - + diff --git a/examples/soak/normal/server0/broker.xml b/examples/soak/normal/server0/broker.xml index 7f1f435f86..76df21fc6f 100644 --- a/examples/soak/normal/server0/broker.xml +++ b/examples/soak/normal/server0/broker.xml @@ -17,7 +17,6 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - @@ -26,12 +25,12 @@ under the License. - tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576?tcpReceiveBufferSize=1048576 + tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576 - tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576?tcpReceiveBufferSize=1048576 + tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576 false diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java index 62ab65c01d..c903831919 100644 --- a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java +++ b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java @@ -16,13 +16,6 @@ */ package org.apache.activemq.artemis.jms.soak.example; -import java.lang.Override; -import java.lang.Runnable; -import java.util.Hashtable; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicLong; -import java.util.logging.Logger; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; @@ -34,6 +27,9 @@ import javax.jms.MessageListener; import javax.jms.Session; import javax.naming.InitialContext; import javax.naming.NamingException; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicLong; +import java.util.logging.Logger; public class SoakReceiver { @@ -49,25 +45,13 @@ public class SoakReceiver public void run() { - String jndiURL = System.getProperty("jndi.address"); - if(jndiURL == null) - { - jndiURL = args.length > 0 ? args[0] : "tcp://localhost:61616"; - } - - System.out.println("Connecting to JNDI at " + jndiURL); - try { String fileName = SoakBase.getPerfFileName(); SoakParams params = SoakBase.getParams(fileName); - Hashtable jndiProps = new Hashtable(); - jndiProps.put("connectionFactory.ConnectionFactory", jndiURL); - jndiProps.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - - final SoakReceiver receiver = new SoakReceiver(jndiProps, params); + final SoakReceiver receiver = new SoakReceiver(params); Runtime.getRuntime().addShutdownHook(new Thread() { @@ -91,8 +75,6 @@ public class SoakReceiver t.start(); } - private final Hashtable jndiProps; - private final SoakParams perfParams; private final ExceptionListener exceptionListener = new ExceptionListener() @@ -149,9 +131,8 @@ public class SoakReceiver private Connection connection; - private SoakReceiver(final Hashtable jndiProps, final SoakParams perfParams) + private SoakReceiver(final SoakParams perfParams) { - this.jndiProps = jndiProps; this.perfParams = perfParams; } @@ -210,7 +191,7 @@ public class SoakReceiver InitialContext ic = null; try { - ic = new InitialContext(jndiProps); + ic = new InitialContext(); ConnectionFactory factory = (ConnectionFactory)ic.lookup(perfParams.getConnectionFactoryLookup()); diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java index 567a72b090..2e81de63c6 100644 --- a/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java +++ b/examples/soak/normal/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java @@ -16,10 +16,6 @@ */ package org.apache.activemq.artemis.jms.soak.example; -import java.util.Hashtable; -import java.util.concurrent.atomic.AtomicLong; -import java.util.logging.Logger; - import javax.jms.BytesMessage; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -31,6 +27,8 @@ import javax.jms.MessageProducer; import javax.jms.Session; import javax.naming.InitialContext; import javax.naming.NamingException; +import java.util.concurrent.atomic.AtomicLong; +import java.util.logging.Logger; import org.apache.activemq.artemis.utils.TokenBucketLimiter; import org.apache.activemq.artemis.utils.TokenBucketLimiterImpl; @@ -41,24 +39,12 @@ public class SoakSender public static void main(final String[] args) { - String jndiURL = System.getProperty("jndi.address"); - if(jndiURL == null) - { - jndiURL = args.length > 0 ? args[0] : "tcp://localhost:61616"; - } - - System.out.println("Connecting to JNDI at " + jndiURL); try { String fileName = SoakBase.getPerfFileName(); SoakParams params = SoakBase.getParams(fileName); - - Hashtable jndiProps = new Hashtable(); - jndiProps.put("connectionFactory.ConnectionFactory", jndiURL); - jndiProps.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); - - final SoakSender sender = new SoakSender(jndiProps, params); + final SoakSender sender = new SoakSender(params); Runtime.getRuntime().addShutdownHook(new Thread() { @@ -79,8 +65,6 @@ public class SoakSender private final SoakParams perfParams; - private final Hashtable jndiProps; - private Connection connection; private Session session; @@ -98,9 +82,8 @@ public class SoakSender }; - private SoakSender(final Hashtable jndiProps, final SoakParams perfParams) + private SoakSender(final SoakParams perfParams) { - this.jndiProps = jndiProps; this.perfParams = perfParams; } @@ -207,7 +190,7 @@ public class SoakSender InitialContext ic = null; try { - ic = new InitialContext(jndiProps); + ic = new InitialContext(); ConnectionFactory factory = (ConnectionFactory)ic.lookup(perfParams.getConnectionFactoryLookup()); diff --git a/examples/soak/normal/src/main/resources/jndi.properties b/examples/soak/normal/src/main/resources/jndi.properties new file mode 100644 index 0000000000..93537c415a --- /dev/null +++ b/examples/soak/normal/src/main/resources/jndi.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory +connectionFactory.ConnectionFactory=tcp://localhost:61616 +queue.queue/exampleQueue=exampleQueue