From b07588a020aa3fb8cc8ac55bda8d555203b93fc9 Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Thu, 26 Oct 2017 15:37:17 -0500 Subject: [PATCH] ARTEMIS-1467 clean up example - Rename example project - Leverage built-in 5.x Camel support instead of using WAR - Clarify instructions - Fix pom names/structure --- .../sub-modules/artemis-jms-bridge/README.md | 93 ----------- .../activemq-artemis-camel/pom.xml | 101 ------------ .../src/main/resources/bridge.xml | 67 -------- .../artemis-jms-bridge/pom.xml | 99 ------------ .../src/main/webapp/WEB-INF/web.xml | 30 ---- .../sub-modules/artemis-jms-bridge/pom.xml | 64 -------- .../artemis-jms-bridge/README.md | 148 ++++++++++++++++++ .../artemis-jms-bridge/pom.xml | 93 +++++++++++ .../bridge/ConnectionFactoryFactoryBean.java | 3 - .../bridge/DestinationFactoryBean.java | 3 - .../src/main/resources/bridge.xml | 15 +- .../src/main/webapp/WEB-INF/web.xml | 0 .../sub-modules/inter-broker-bridge/pom.xml | 39 +++++ examples/features/sub-modules/pom.xml | 2 +- pom.xml | 9 +- 15 files changed, 292 insertions(+), 474 deletions(-) delete mode 100644 examples/features/sub-modules/artemis-jms-bridge/README.md delete mode 100644 examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/pom.xml delete mode 100644 examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/src/main/resources/bridge.xml delete mode 100644 examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/pom.xml delete mode 100644 examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/webapp/WEB-INF/web.xml delete mode 100644 examples/features/sub-modules/artemis-jms-bridge/pom.xml create mode 100644 examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/README.md create mode 100644 examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/pom.xml rename examples/features/sub-modules/{artemis-jms-bridge => inter-broker-bridge}/artemis-jms-bridge/src/main/java/org/artemis/bridge/ConnectionFactoryFactoryBean.java (94%) rename examples/features/sub-modules/{artemis-jms-bridge => inter-broker-bridge}/artemis-jms-bridge/src/main/java/org/artemis/bridge/DestinationFactoryBean.java (94%) rename examples/features/sub-modules/{artemis-jms-bridge => inter-broker-bridge}/artemis-jms-bridge/src/main/resources/bridge.xml (82%) rename examples/features/sub-modules/{artemis-jms-bridge/activemq-artemis-camel => inter-broker-bridge/artemis-jms-bridge}/src/main/webapp/WEB-INF/web.xml (100%) create mode 100644 examples/features/sub-modules/inter-broker-bridge/pom.xml diff --git a/examples/features/sub-modules/artemis-jms-bridge/README.md b/examples/features/sub-modules/artemis-jms-bridge/README.md deleted file mode 100644 index 9f60eb46ef..0000000000 --- a/examples/features/sub-modules/artemis-jms-bridge/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# artemis-jms-bridge - -An example project showing how to do different varieties of bridging with ActiveMQ Brokers. - -## ActiveMQ to Artemis Camel Bridge - -This is an example of using Camel in the ActiveMQ broker to bridge messages between ActiveMQ and Artemis. - -### Prerequisites - -- install ActiveMQ -- install Artemis - -### Preparing - -From the root directory run `mvn clean package` - -Copy activemq-artemis-camel/target/activemq-artemis-camel-1.0.0-SNAPSHOT.war to the deploy dir of the ActiveMQ installation. - -Create an instance of the Artemis broker `$ARTEMIS_HOME/bin/artemis create --allow-anonymous --user admin --password password myBroker` - -Edit the $ARTEMIS_INSTANCE/etc/broker.xml and change the acceptor to listen to port 61617. Comment or remove all other acceptors. - -```xml - - tcp://0.0.0.0:61617?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300 - -``` - -### Testing - -Start the Artemis broker. - -`$ARTEMIS_INSTANCE/bin/artemis run` - -Start the ActiveMQ broker. - -`$ACTIVEMQ_HOME/bin/standalone` - -Send some messages to the ActiveMQ broker. - -`./apache-activemq-5.11.0/bin/activemq producer --user admin --password password --destination queue://TEST.FOO` - -Log into the Artemis console and browse the messages in the TEST.FOO queue. - -## Artemis to ActiveMQ JMS Bridge - -This is an example of using the JMS bridge shipped with the Artemis broker to bridge to ActiveMQ. - -###Prerequisites - -- install ActiveMQ -- install Artemis - -###Preparing - -From the root dir run `mvn clean package`. - -Copy artemis-jms-bridge/target/artemis-jms-bridge-1.0.0-SNAPSHOT.war to the web directory of the Artemis installation. - -Create an instance of the Artemis broker `$ARTEMIS_HOME/bin/artemis create --allow-anonymous --user admin --password password myBroker` - -Edit the $ARTEMIS_INSTANCE/etc/broker.xml and change the acceptor to use invm. - -```xml - - tcp://0.0.0.0:61617?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300 - vm://0 - -``` - -Edit the $ARTEMIS_INSTANCE/etc/bootstrap.xml and add the war file. - -```xml - -``` - -###Testing - - -Start the ActiveMQ broker. - -`$ACTIVEMQ_HOME/bin/standalone` - -Start the Artemis broker. - -`$ARTEMIS_INSTANCE/bin/artemis run` - -Send some messages to the queue TEST.BAR via the Artemis console. - -`$ARTEMIS_INSTANCE/bin/artemis producer --user admin --password password --destination queue://TEST.BAR --url tcp://localhost:61617 --message-count 1` - -Log into the ActiveMQ console and browse the messages in the TEST.BAR queue. diff --git a/examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/pom.xml b/examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/pom.xml deleted file mode 100644 index cfe72a7bea..0000000000 --- a/examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - 4.0.0 - - - org.apache.artemis.examples - artemis-jms-bridge-parent - 1.0.0-SNAPSHOT - - - activemq-artemis-camel - - war - - ActiveMQ to Artemis Camel Example - An example project showing how to do JMS bridging in ActiveMQ to Artemis using Apache Camel. - - - UTF-8 - UTF-8 - - 8 - 8 - - 3.1.0 - - 2.18.1 - 4.3.4.RELEASE - 1.1.0.Final - - - - - org.apache.activemq - activemq-client - 5.11.0 - - - org.apache.activemq - activemq-camel - 5.11.0 - - - org.apache.activemq - artemis-jms-client - 2.0.0 - - - org.apache.camel - camel-core - ${camel.version} - - - org.apache.camel - camel-spring - ${camel.version} - - - org.apache.camel - camel-jms - ${camel.version} - - - org.springframework - spring-web - ${spring.version} - - - org.jboss.slf4j - slf4j-jboss-logging - ${slf4j-jboss-logging.version} - - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - - - - diff --git a/examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/src/main/resources/bridge.xml b/examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/src/main/resources/bridge.xml deleted file mode 100644 index 23224b418f..0000000000 --- a/examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/src/main/resources/bridge.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/pom.xml b/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/pom.xml deleted file mode 100644 index 3f34937ee3..0000000000 --- a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - 4.0.0 - - - org.apache.artemis.examples - artemis-jms-bridge-parent - 1.0.0-SNAPSHOT - - - artemis-jms-bridge - - war - - Artemis JMS Bridge Example - An example project showing how to do JMS bridging in Artemis to an ActiveMQ. - - - UTF-8 - UTF-8 - - 8 - 8 - - 3.1.0 - - 2.18.1 - 4.3.4.RELEASE - 1.1.0.Final - - - - - org.apache.activemq - activemq-client - 5.11.0 - - - org.apache.activemq - activemq-camel - 5.11.0 - - - org.apache.activemq - artemis-jms-client - 2.0.0 - provided - - - org.apache.activemq - artemis-server - 2.0.0 - provided - - - org.apache.activemq - artemis-jms-server - 2.0.0 - provided - - - org.springframework - spring-web - ${spring.version} - - - org.jboss.slf4j - slf4j-jboss-logging - ${slf4j-jboss-logging.version} - - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - - - - diff --git a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/webapp/WEB-INF/web.xml b/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 710cad2f45..0000000000 --- a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - JMS Bridge Loader - - - contextConfigLocation - classpath:bridge.xml - - - org.springframework.web.context.ContextLoaderListener - - - \ No newline at end of file diff --git a/examples/features/sub-modules/artemis-jms-bridge/pom.xml b/examples/features/sub-modules/artemis-jms-bridge/pom.xml deleted file mode 100644 index 2b46a9dcb4..0000000000 --- a/examples/features/sub-modules/artemis-jms-bridge/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - 4.0.0 - - org.apache.artemis.examples - artemis-jms-bridge-parent - 1.0.0-SNAPSHOT - - pom - - Active Messaging Bridge Examples - An example project showing different ways to use bridges with ActiveMQ and Artemis. - - - UTF-8 - UTF-8 - - 8 - 8 - - 3.1.0 - - 2.18.1 - 4.3.4.RELEASE - 1.1.0.Final - - - - activemq-artemis-camel - artemis-jms-bridge - - - - - - true - never - - - false - - fuse-public-repository - FuseSource Community Release Repository - https://repo.fusesource.com/nexus/content/groups/public - - - - diff --git a/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/README.md b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/README.md new file mode 100644 index 0000000000..f788881070 --- /dev/null +++ b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/README.md @@ -0,0 +1,148 @@ +# Artemis to 5.x JMS Bridge + +This is an example of using the JMS bridge shipped with the Artemis broker to bridge to a 5.x broker. + +Notes: + +- The Artemis JMS bridge is a general purpose bridge and can be used to bridge to any JMS provider which implements JNDI. +This example however is just focusing on integration with 5.x. +- The Artemis JMS bridge can "push" _and_ "pull" messages so it can be used to move messages both ways. + +##Prerequisites + +- install ActiveMQ 5.x +- install ActiveMQ Artemis + +##Preparing + +1) From the root dir run `mvn clean package`. + +2) Copy artemis-jms-bridge/target/artemis-jms-bridge-.war to the web directory of the Artemis installation. + +3) Create an instance of the Artemis broker `$ARTEMIS_HOME/bin/artemis create --allow-anonymous myBroker` + +4) Edit the `$ARTEMIS_INSTANCE/etc/broker.xml` and change the `artemis` acceptor to run on 61617 and add the `invm` acceptor. + +```xml + + tcp://0.0.0.0:61617?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300 + vm://0 + +``` + +5) Edit `$ARTEMIS_INSTANCE/etc/bootstrap.xml` and add the war file. + +```xml + +``` + +##Testing + +Start the ActiveMQ broker. + +`$ACTIVEMQ_HOME/bin/standalone` + +Start the Artemis broker. + +`$ARTEMIS_INSTANCE/bin/artemis run` + +Send some messages to the queue TEST.BAR via the Artemis console. + +`$ARTEMIS_INSTANCE/bin/artemis producer --destination queue://TEST.BAR --url tcp://localhost:61617 --message-count 1` + +Log into the ActiveMQ 5.x console and browse the messages in the TEST.BAR queue. + +# 5.x to Artemis Camel JMS Bridge + +This is an alternative to using the Artemis JMS bridge using Camel in the 5.x broker to bridge messages to Artemis. +There isn't anything to deploy here. It's just a set of instructions. + +This approach might be preferred if for example you only have access to the 5.x broker. + +## Prerequisites + +- install ActiveMQ 5.x +- install ActiveMQ Artemis + +## Preparing + +1) Fetch the `artemis-jms-client-all` jar from [Maven Central](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.activemq%22%20AND%20a%3A%22artemis-jms-client-all%22) + which corresponds to the version of ActiveMQ Artemis installed. Copy that jar to the `$5X_HOME/lib` directory. + +2) Add the bridge configuration to `activemq.xml`: + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +3) Ensure the `xsi:schemalocation` in activemq.xml contains the necessary Camel schemas: + +``` +http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd +``` + +4) Create an instance of the Artemis broker `$ARTEMIS_HOME/bin/artemis create --allow-anonymous myBroker` + +5) Edit the `$ARTEMIS_INSTANCE/etc/broker.xml` and change the acceptor to listen to port 61617. Comment or remove all other acceptors. + +```xml + + tcp://0.0.0.0:61617?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300 + +``` + +6) Edit `$ARTEMIS_INSTANCE/etc/bootstrap.xml` so that the embedded web server runs on a different port that the 5.x broker (e.g. 8162): + +```xml + +``` + +## Testing + +Start the Artemis broker. + +`$ARTEMIS_INSTANCE/bin/artemis run` + +Start the ActiveMQ 5.x broker. + +`$5X_HOME/bin/activemq start` + +Send some messages to the ActiveMQ 5.x broker. + +`$5X_HOME/bin/activemq producer --user admin --password password --destination queue://TEST.FOO` + +Log into the ActiveMQ Artemis console and browse the messages in the `TEST.FOO` queue. + diff --git a/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/pom.xml b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/pom.xml new file mode 100644 index 0000000000..11ee24a19c --- /dev/null +++ b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/pom.xml @@ -0,0 +1,93 @@ + + + + + 4.0.0 + + + org.apache.artemis.examples + inter-broker-bridge-parent + 2.4.0-SNAPSHOT + + + artemis-jms-bridge + + war + + Artemis JMS Bridge Example + + + ${project.basedir}/../../../../.. + + + + + org.apache.activemq + activemq-client + ${activemq5-version} + + + org.apache.activemq + artemis-jms-client + ${project.version} + provided + + + org.apache.activemq + artemis-server + ${project.version} + provided + + + org.apache.activemq + artemis-jms-server + ${project.version} + provided + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + javax.management.j2ee + javax.management.j2ee-api + 1.1.1 + + + org.jboss.slf4j + slf4j-jboss-logging + 1.1.0.Final + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + + + diff --git a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/ConnectionFactoryFactoryBean.java b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/ConnectionFactoryFactoryBean.java similarity index 94% rename from examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/ConnectionFactoryFactoryBean.java rename to examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/ConnectionFactoryFactoryBean.java index 5bf05eaca5..1bf29ce676 100644 --- a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/ConnectionFactoryFactoryBean.java +++ b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/ConnectionFactoryFactoryBean.java @@ -18,9 +18,6 @@ package org.artemis.bridge; import javax.jms.ConnectionFactory; -/** - * @author Andy Taylor - */ public class ConnectionFactoryFactoryBean implements org.apache.activemq.artemis.jms.bridge.ConnectionFactoryFactory { private final ConnectionFactory connectionFactory; diff --git a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/DestinationFactoryBean.java b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/DestinationFactoryBean.java similarity index 94% rename from examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/DestinationFactoryBean.java rename to examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/DestinationFactoryBean.java index 00b8b95b3c..f5428fda07 100644 --- a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/DestinationFactoryBean.java +++ b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/java/org/artemis/bridge/DestinationFactoryBean.java @@ -20,9 +20,6 @@ import org.apache.activemq.artemis.jms.bridge.DestinationFactory; import javax.jms.Destination; -/** - * @author Andy Taylor - */ public class DestinationFactoryBean implements DestinationFactory { private final Destination destination; diff --git a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/resources/bridge.xml b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/resources/bridge.xml similarity index 82% rename from examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/resources/bridge.xml rename to examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/resources/bridge.xml index ac76647f87..3409954c60 100644 --- a/examples/features/sub-modules/artemis-jms-bridge/artemis-jms-bridge/src/main/resources/bridge.xml +++ b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/resources/bridge.xml @@ -16,15 +16,14 @@ limitations under the License. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - - + + @@ -43,7 +42,7 @@ limitations under the License. - + @@ -54,9 +53,9 @@ limitations under the License. - + - + @@ -64,6 +63,4 @@ limitations under the License. - - diff --git a/examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/src/main/webapp/WEB-INF/web.xml b/examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from examples/features/sub-modules/artemis-jms-bridge/activemq-artemis-camel/src/main/webapp/WEB-INF/web.xml rename to examples/features/sub-modules/inter-broker-bridge/artemis-jms-bridge/src/main/webapp/WEB-INF/web.xml diff --git a/examples/features/sub-modules/inter-broker-bridge/pom.xml b/examples/features/sub-modules/inter-broker-bridge/pom.xml new file mode 100644 index 0000000000..3a3d693b68 --- /dev/null +++ b/examples/features/sub-modules/inter-broker-bridge/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + + org.apache.activemq.examples.modules + broker-modules + 2.4.0-SNAPSHOT + + + org.apache.artemis.examples + inter-broker-bridge-parent + 2.4.0-SNAPSHOT + + pom + + ActiveMQ Artemis Inter-broker Bridging Examples + + + ${project.basedir}/../../../.. + + + + artemis-jms-bridge + + diff --git a/examples/features/sub-modules/pom.xml b/examples/features/sub-modules/pom.xml index c49c758cc5..5330de5900 100644 --- a/examples/features/sub-modules/pom.xml +++ b/examples/features/sub-modules/pom.xml @@ -50,7 +50,7 @@ under the License. release artemis-ra-rar - artemis-jms-bridge + inter-broker-bridge diff --git a/pom.xml b/pom.xml index 74f206d9dc..9a74e952be 100644 --- a/pom.xml +++ b/pom.xml @@ -113,6 +113,7 @@ 0.7.9 1.4.3 + 5.0.1.RELEASE ${project.version} 1 @@ -318,28 +319,28 @@ org.springframework spring-core - 3.1.4.RELEASE + ${spring.version} compile org.springframework spring-beans - 3.1.4.RELEASE + ${spring.version} compile org.springframework spring-context - 3.1.4.RELEASE + ${spring.version} compile org.springframework spring-jms - 3.1.4.RELEASE + ${spring.version} compile