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
Get Installed Apache ActiveMQ on Ubuntu:Installing ActiveMQ for Ubuntu
Open a Shell Session
Ctrl+Alt+t on Desktop
(Press “Enter” to Execute Commands)
- Starting ActiveMQ Console:
sudo su -c "/opt/apache-activemq*/bin/activemq console"
- Then Open another Terminal Tab:
- Install Apache Ant:
apt-get install ant
- Start First Example:
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.
- Open a third Terminal Tab:
- Start Second Example:
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.