Run an ActiveMQ example

The following steps walk you through running an ActiveMQ example using the Java source code.

  • First, ensure that you have Maven installed on the server. If you don’t, install it following these instructions:

    • Debian:

      $ sudo apt-get install maven

    • CentOS:

      $ sudo wget -O /etc/yum.repos.d/epel-apache-maven.repo $ sudo yum install apache-maven

  • Next, activate a Maven profile. To do this, modify the Maven settings.xml file (usually located in /etc/maven/settings.xml or /etc/maven2/settings.xml, although the path might differ on your server) and include the following:

  • Go to the examples/ folder and install it using maven:

    $ cd /opt/bitnami/activemq/examples/amqp/java
    $ sudo mvn install
  • Export the environment variables you need and run the example. Note that you can obtain your server’s private IP address by using the /sbin/ifconfig command.

    $ export ACTIVEMQ_USER=admin
    $ java -cp target/amqp-example-0.1-SNAPSHOT.jar example.Listener &
    $ java -cp target/amqp-example-0.1-SNAPSHOT.jar example.Publisher

Execute the Listener and Publisher on different machines. You should now see the example running.

Last modification September 4, 2018