ActiveMQ Deployment on OneOps

screen-shot-2016-09-12-at-12-56-04-am

Apache ActiveMQ is an open source message broker that is developed in Java and with a full Java Message Service (JMS) client. As oriented for enterprise use cases, it supports multiple Java standards, languages and protocols:

  • JMS 1.1, J2EE 1.4, JCA 1.5 and XA
  • Java, C, C++, C#, Ruby, Perl, Python, PHP
  • TCP, SSL, NIO, UDP, multicast, JGroups and JXTA transports

In this blog, I would like to introduce how to deploy ActiveMQ on OneOps.

First, choose ActiveMQ pack in the Design phase.

screen-shot-2016-09-12-at-12-25-51-am

For the demonstration purpose, in activemq component, we could keep everything default, but Auth Type set to None, such as following,

Screen Shot 2016-09-12 at 12.51.56 AM.png

In more serious cases, JAAS or other authentication methods should be used.

There are also two optional components: queue and topic that could be added upfront or later when needed. It is highly to recommended to create/edit/delete queue and topic in the OneOps layer. This is because: (1) take advantage of the OneOps audit trail so that we know which changes have been made. (2) more statistics about the topic or queue (e.g. message in/out per second, pending messages per second) could be provided and visualized on OneOps UI.

Last, we could add our own SSH key to the user-activemq component so that we could log into the VM later on.

Commit the design and we are ready to deploy ActiveMQ. Create a new environment with Availability Mode = single and 1 cloud as primary cloud, as ActiveMQ is not a distributed system by its nature and the current ActiveMQ pack did not fully support a High Availability (HA) deployment out-of-the-box. It may be the future work to have the pack support some Master-Slave deployment.

The deployment plan may resemble as following,

Screen Shot 2016-09-12 at 1.56.55 AM.png

After the deployment, we could SSH into the ActiveMQ broker and run a simple JMS program to test the ActiveMQ.

On the broker machine, download the hello world JMS code and save it as App.java, then use an editor to change the following  from

ActiveMQConnectionFactory("vm://localhost");

To

ActiveMQConnectionFactory("nio://0.0.0.0:61616");

Save the change and compile the code by: javac -cp /opt/activemq/activemq-all-5.13.0.jar App.java

Then run the code by: java -classpath /opt/activemq/activemq-all-5.13.0.jar:. App

The output of the code run would be:

Sent message: 140686497 : Thread-0
Sent message: 104414848 : Thread-1
Received: Hello world! From: Thread-23 : 2112836430
Sent message: 125493280 : Thread-9
Sent message: 1026563844 : Thread-6
Received: Hello world! From: Thread-0 : 1499689553
Received: Hello world! From: Thread-6 : 336615606
Received: Hello world! From: Thread-9 : 1948548290
Sent message: 907776190 : Thread-17
Sent message: 645246177 : Thread-16
Sent message: 1998048735 : Thread-12
Received: Hello world! From: Thread-30 : 1818405427
Received: Hello world! From: Thread-9 : 574906110
Sent message: 1335593353 : Thread-19
Sent message: 1799775865 : Thread-25
Sent message: 935344593 : Thread-30
Sent message: 1964711431 : Thread-23
Received: Hello world! From: Thread-0 : 1694803203
Received: Hello world! From: Thread-19 : 686363848
Sent message: 271300696 : Thread-27
Received: Hello world! From: Thread-25 : 2112836430
Received: Hello world! From: Thread-23 : 756278511
Received: Hello world! From: Thread-1 : 321452604
Received: Hello world! From: Thread-25 : 523145999

The above output shows that ActiveMQ broker is working properly.

Another place to check ActiveMQ is through its web admin console. Open a browser and enter http://platform_level_fqdn_or_ip:8161/admin. The platform_level_fqdn could be retrieved from the these steps: go to Operate phase, click your_activemq_platform_name on the right,  find fqdn component and click into, the shorter URL is platform_level_fqdn.

The browser will have a pop-up window to ask for username and passwords, which are admin by default.

After logging into the web admin console, the main page should look like:

Screen Shot 2016-09-12 at 2.17.59 AM.png

We could further check the information of the queue that is just created for the “hello world” JMS code.

Screen Shot 2016-09-12 at 2.18.46 AM.png

Monitoring & Alerting

In Operate phase, some statistics about ActiveMQ broker could be visualized on OneOps UI. For example, for an ActiveMQ instance, click to Operate Tab, which will show the following 3 items to monitors:

Screen Shot 2016-09-12 at 2.28.54 AM.png

The BrokerStatus shows some broker related statistics:

Screen Shot 2016-09-12 at 2.30.25 AM.png

The Memory Status shows some memory related statistics on the broker:

Screen Shot 2016-09-12 at 2.31.53 AM.png

The Log  will alert if there is some critical log exception in the ActiveMQ broker log file, within 15 minutes.

Screen Shot 2016-09-12 at 2.32.44 AM.png

Summary

Here is a more detailed user guide about ActiveMQ pack on OneOps, especially for setting up SSL, authorization and authentication. To make it better for production, the future work may be to add clustering to support HA and Disaster Recovery.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s