ActiveMQ is a cross platform open source messaging server that supports a variety of languages and protocols. It includes support for AMQP 1.0. Some work on node-qpid required a local server for testing and debugging, thus ActiveMQ.

ActiveMQ is quite powerful, but for my needs the docs to simply getting it setup, configured, and running were a bit convoluted. Below are simple steps to getting ActiveMQ installed, configured, and running as an AMQP 1.0 server.

Installation

ActiveMQ requires Java to be installed. The OpenJDK will work fine and is often less hassle to install than the official Oracle release. ActiveMQ requires Java 6 or higher. I went with Java 8.

amqpid: gonzo$ sudo apt-get install openjdk-8-jdk

Ubuntu and other Linux distributions typically have a version of ActiveMQ available as a package. However, they are often older than what is available on the ActiveMQ site. To retrieve the binary release of 5.10.0:

amqpid: gonzo$ wget http://activemq.apache.org/path/tofile/apache-activemq-5.10.0-bin.tar.gz

Determine the actual link from the ActiveMQ download page.

I’ve installed ActiveMQ into /usr/local as follows:

amqpid: gonzo$ tar -zxvf apache-activemq-5.10.0-bin.tar.gz
amqpid: gonzo$ sudo mv apache-activemq-5.10.0 /usr/local/
amqpid: gonzo$ sudo ln -s /usr/local/apache-activemq-5.10.0 /usr/local/activemq

Configuration

ActiveMQ can run with a default configuration, or you can set up an initial configuration in either /etc/default or /home/gonzo. If you don’t set up a configuration, you will constantly be prompted with the following message:

INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /home/gonzo/.activemqrc)

INFO: Invoke the following command to create a configuration file
/usr/local/activemq/bin/activemq setup [ /etc/default/activemq | /home/gonzo/.activemqrc ]

So, create the configuration as follows:

amqpid: gonzo$ sudo /usr/local/activemq/bin/activemq setup /etc/default/activemq

INFO: Creating configuration file: /etc/default/activemq
INFO: It's recommend to limit access to '/etc/default/activemq' to the priviledged user
INFO: (recommended: chown 'root':nogroup '/etc/default/activemq'; chmod 600 '/etc/default/activemq')

With ActiveMQ, you can use the default configuration files in ACTIVEMQ_HOME/conf or you can set up your own configuration. The command line tool adds a utility to help with this. For this tutorial, I will assume that configuration will live in /home/gonzo/sys/activemq. To create that configuration:

amqpid: gonzo$ /usr/local/activemq/bin/activemq create /home/gonzo/sys/activemq/amqptest

This will create the necessary configuration files (as well as a shortcut script) under the directory /home/gonzo/sys/activemq/amqptest..

For my purposes, I only want the AMQP protocol running. By default, several others are configured. In order to limit the allowed protocols/open ports, open the file /home/gonzo/sys/activemq/amqptest in an editor. Look for a section resembling:

<transportConnectors>
    <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
</transportConnectors>

And replace it with:

<transportConnectors>
    <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
</transportConnectors>

Save the file and exit the editor.

Running ActiveMQ

Now that ActiveMQ is installed and configured, you can run the configuration as follows:

amqpid: gonzo$ /home/gonzo/sys/activemq/amqptest/bin/amqptest start
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/home/gonzo/sys/activemq/amqptest/data/activemq-amqpid.pid' (pid '10674')

To verify that ActiveMQ is running:

amqpid: gonzo$ /home/gonzo/sys/activemq/amqptest/bin/amqptest status
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
ActiveMQ is running (pid '10674')

And to see it listening on a port (the default AMQP port is 5762):

amqpid: gonzo$ netstat -an | grep 5672
tcp6       0      0 :::5672                 :::*                    LISTEN