Getting-Started with ActiveMQ for JMS on Ubuntu Linux Easy Guide

April 12th, 2017 by thelinuxevangelist

JMS Quick-Start on Ubuntu Linux

The JMS Tutorial Show How-to Getting-Started with ActiveMQ for Java Message Service Development on Ubuntu Linux.

As Pre-Requisite for Apache ActiveMQ is the Oracle Java SE JDK 7+ Installation on Ubuntu Linux.

Some ActiveMQ Framework Features:

  • Fully JMS Compliant
  • Connectivity (Wide range of Connectivity Options with protocols: Http/s, IP multicast, STOMP, TCP, UDP, XMPP)
  • Pluggable persistence and security
  • Building messaging applications with Java
  • Integration with application servers (Apache Tomcat, Jetty, Apache Geronimo, JBoss)
  • Client APIs (C/C++,.NET,Perl,Python,Ruby and more)
  • Broker clustering (Many ActiveMQ brokers can work together as a network of brokers for scalability purposes)
  • Dramatically simplified administration
Getting-Started with ActiveMQ JMS on Ubuntu Linux - Featured
  1. Get Installed Apache ActiveMQ on Ubuntu:

    Installing ActiveMQ for Ubuntu
  2. Open a Shell Session
    Ctrl+Alt+t on Desktop
    (Press “Enter” to Execute Commands)

    Apache ActiveMQ Quick-Start on Ubuntu Linux - Featured
  3. Starting ActiveMQ Console:
    sudo su -c "/opt/apache-activemq*/bin/activemq console"
  4. Then Open another Terminal Tab:
    Ctrl+Shift+t
  5. Install Apache Ant:
    apt-get install ant
  6. Start First Example:
    cd /opt/apache-activemq*/example
    ant consumer

    The command compiles the Java examples and starts up a simple JMS consumer. As
    you can see from the output, this consumer is:

    • Connecting to the broker using the TCP protocol (tcp://localhost:61616)
    • Watching a queue named TEST.FOO
    • Using nondurable subscription
    • Waiting to receive 2000 messages before shutting down

    Basically, the JMS consumer is connected to ActiveMQ and waiting for messages. Now
    you can send some messages to the TEST.FOO destination.

  7. Open a third Terminal Tab:
    Ctrl+Shift+t
  8. Start Second Example:
    cd /opt/apache-activemq*/example
    ant producer

    Although the output has been truncated for readability, the command starts up a simple
    JMS producer and you can see from the output that it:

    • Connects to the broker using the TCP connector (tcp://localhost:61616)
    • Publishes messages to a queue named TEST.FOO
    • Uses nonpersistent messages
    • Doesn’t sleep between publishing messages

    Once the JMS producer is connected, it then sends 2,000 messages and shuts down.