Monday, December 1, 2014

Running multiple ActiveMQ instances on one machine

1. Download and unzip the ActiveMQ
http://activemq.apache.org/

2. Go to the ActiveMQ home directory and create the instances as follows
cd <ACTIVEMQ_HOME>
./bin/activemq create instanceA
./bin/activemq create instanceB

3. Do ls -l you can see two sub directories created as instanceA and instance B

4. Let instanceA to use the default config, modify the config of instanceB
Go to the instanceB/conf folder and open the file jetty.xml to make the webconsole available at port '8162'

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

5. Open the activemq.xml file and modify tcp port to '61617'

       <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61617"/>
        </transportConnectors>

6. Save the both files and start the instances in two consoles
go to the instanceA/bin folder and ./activemq console
go to the instanceB/bin folder and ./activemq console