/virtual-topic-migration

An example of a rolling migration of virtual topics frpm ActiveMQ to Artemis

Primary LanguageJava

This project is an example of how you might upgrade from ActiveMQ to Artemis in a rolling fashion when you are using Virtual topics.

Migrating Openwire consumers to Artemis

Create the activemq instance using the command

mvn clean package -Pcreateactivemq

Now start activemq

./activemq-virtual-topic/target/activemq/bin/activemq start

Now create the artemis instance

mvn clean package -Pcreateartemis

Now run the artemis instance

./artemis-virtual-topic/target/artemis-instance//bin/artemis run

Now we can start 2 openwire consumers that will be connected to the virtual topic VirtualTopic.TopicA via the queue Consumer.myConsumer1.VirtualTopic.TopicA by running this command in 2 shells

mvn verify -Pactivemqowconsumer

Now we can start an openwire consumer connected to artemis which will connect to address VirtualTopic.TopicA and create a multicast queue Consumer.myConsumer1.VirtualTopic.TopicA

mvn verify -Partemisowconsumer

now we can start sending messages to the virtual topic VirtualTopic.TopicA which we will see consumed by the 2 activemq consumers

mvn verify -Pactivemqproducer

Start a camel bridge by running this command in the virtual-topic-bridge directory

mvn exec:java -PCamelServer

you should now see the message also being sent to the 3rd consumer sharing the load on Artemis, you can now stop the activemq consumers and start more if needed on Artemis. The consumers are now migrated to Artemis with no loss of service.

Also instead of using openwire you can use an amqp jms consumer and use an fqqn, for this you would need to change the queue in the Artemis broker.xml to:

<address name="VirtualTopic.TopicA">
   <multicast>
      <queue name="Consumer.myConsumer1.VirtualTopic.TopicA"/>
   </multicast>
</address>

and the consumer would consume from:

VirtualTopic.TopicA::Consumer.myConsumer1.VirtualTopic.TopicA

You can run the amqp receive via:

mvn verify -Partemisamqpconsumer

##Migrating consumers to use JMS 2.0 via AMQP