Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Starting Multiple JBoss A-MQ JVMs on the Same Machine

DZone's Guide to

Starting Multiple JBoss A-MQ JVMs on the Same Machine

Learn how to start multiple JBoss A-MQ instances on a single machine.

· Integration Zone
Free Resource

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

So I haven’t been blogging as much recently — just been really busy. But my New Year’s resolution is to blog a little more sharing some things I come across frequently, even if it’s simple stuff that might help some people out.

So for this entry, I’ll show a quick way to start up multiple JBoss A-MQ instances on a single machine. The reason why this question comes up is because JBoss A-MQ includes a little more “enterprise” ready features out of the box than plain old community ActiveMQ. JBoss A-MQ is a production-ready, hardened, version of ActiveMQ, and it’s packaged inside Apache Karaf with some other features like the HawtIO console (and more).

What happens when people are trying to simulate more complex deployment scenarios in a lab or development environment, they may not have access to multiple VMs or machines to try out a full real-world deployment. So they may want to install multiple brokers on a single box. This is pretty straight forward, and all you have to do is make sure the default ports don’t conflict. NOTE: this is not intended to be a production deployment!!! Don’t deploy this way to production!!

You can get pretty wacky and customize each additional A-MQ/Karaf JVM with the Karaf admin commands but if you want to just get something working and want to understand where the port conflicts can be, check this out:

Download JBoss A-MQ

Go to the Red Hat support portal (or JBoss.org) and download the copy of JBoss A-MQ you want to use. Note, the bits are the same from whichever website you download from, but you need a valid subscription to use in any shared environments (anything excluding your development laptop).

For this exercise, we’re using JBoss A-MQ 6.1 (filename jboss-a-mq-6.1.0.redhat-379.zip)

Install into two locations

If we want to have two separate JBoss A-MQ brokers, let’s start by unpacking into two separate locations:

~> unzip jboss-a-mq-6.1.0.redhat-379.zip -d amq01
~> unzip jboss-a-mq-6.1.0.redhat-379.zip -d amq02

Now in each installation path (eg, ./amq01/jboss-a-mq-6.1.0.redhat-379), which we’ll call the broker’s BASE directory, find the files in the $BASE/etc folder with the name users.properties. Uncomment the last line in that file so we have an admin user.

Change ports

Last step we need to do is change the ports in the installation for amq02 so they don’t conflict.

There are three files we’ll need to touch, which are the config PIDs for the services that run in the container.

etc/org.apache.karaf.management.cfg

In this file, edit the following properties:

rmiRegistryPort = 1098  #default is 1099
rmiServerPort = 44445   #default is 44444

Note, those are the changed values. You can change them to whatever you want.

etc/org.apache.karaf.shell.cfg

In this file, edit the following properties:

sshPort = 8102  #default is 8101

etc/system.properties

And lastly, in this file, edit:

org.osgi.service.http.port=8182   #default is 8181
activemq.port = 61617   #default is 61616
activemq.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:1098/karaf-${karaf.na

Start up your brokers

Go and start up your brokers with $BASE/bin/amq script, and you should have two running brokers, without collisions on ports.

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

Topics:
integration ,activemq ,apache karaf ,hawtio ,a-mq ,jboss a-mq

Published at DZone with permission of Christian Posta, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}