Running Multiple ActiveMQ Instances on One Machine

The Integration Zone is brought to you in partnership with WSO2. Learn more about WSO2's API Management by watching their on-demand webinar.html

A few weeks ago I started making use of Apache ActiveMQ again as the JMSprovider with my Mule ESB solution. Since it had been a few years that I used ActiveMQ I thought it would be nice to check out some of the (new) features like the failover transport and other clustering features. To be able to test these last things I needed multiple installations of ActiveMQ on my machine. Luckily this isn’t very hard to accomplish, although the documentation on this on the ActiveMQ site is quite minimal.web



The first step is to download and unzip the ActiveMQ package, which I did at ~/develop/apache-activemq-5.8.0.shell

To create the instances I go to the activeMQ home directory and use the ‘create’ command like this:express

cd develop/apache-activemq-5.8.0/
./bin/activemq create instanceA
./bin/activemq create instanceB

Now if you do a ‘ls -l’ you will see that there are two subdirectories created, ‘instanceA’ and ‘instanceB’. Since both instances will make use of the default ports we have to modify the config for the second instance. Go to the directory ‘develop/apache-activemq-5.8.0/instanceB/conf’ and open the file ‘jetty.xml’ to make the webconsole available at port ’8162′ by modifying the following line:apache

<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
  <property name="port" value="8162" />
</bean>

Next open the file ‘activemq.xml’ in the same directory and modify the following part:
api

<transportConnectors>
  <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
  <transportConnector name="openwire" uri="tcp://0.0.0.0:61617?maximumConnections=1000&wireformat.maxFrameSize=104857600"/>
  <transportConnector name="amqp" uri="amqp://0.0.0.0:5673?maximumConnections=1000&wireformat.maxFrameSize=104857600"/>
 </transportConnectors>

That’s it! Make sure both files are saved and start the first instance with:
eclipse

cd ~/develop/apache-activemq-5.8.0/instanceA/bin
./instanceA console

Open up a new console and run the commands:
tcp

cd /Users/pascal/develop/apache-activemq-5.8.0/instanceB/bin
./instanceB console


Now you have two instances running next to each other and can start testing the ‘advanced’ functions of ActiveMQ.
ide


The Integration Zone is brought to you in partnership with WSO2. Learn more about WSO2's API Management by watching their on-demand webinar.wordpress

Published at DZone with permission of Pascal Alma, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

相關文章
相關標籤/搜索