Enterprise Integration Zone is brought to you in partnership with:

Bosanac Dejan is a Senior Software Engineer at FuseSource specializing in messaging and integration with Apache ActiveMQ Dejan is a DZone MVB and is not an employee of DZone and has posted 16 posts at DZone. You can read more from them at their website. View Full User Profile

ActiveMQ and HawtIO

05.02.2014
| 3032 views |
  • submit to reddit

We introduced HawtIO console as a tech preview in 5.9.0 ActiveMQ release, with an idea to replace the old and rusty web console in the distribution. Unfortunately, that idea didn’t go well with the rest of Apache community so it’s voted out and 5.9.1 is released without it. You can read more on the topic of distributing non-Apache developed web consoles in Apache projects in this (lengthy) thread if you’re interested.

Anyhow, there’s a lot of people out there who liked HawtIO and are asking questions on how to use it with the future (and some old) releases. So here, I’ll try to sum up different ways of how ActiveMQ and HawtIO can be used together.

HawtIO is pure JavaScript application that doesn’t have any server-side component. It uses Jolokia REST API to access managed servers. As a pure JavaScript application it’s possible to package it as a Chrome application, so you can run HawtIO locally in your browser. Take a look at the HawtIO Get Started guide on how to do this.

Once, you have your console running you can use it to connect to any remote broker, running management REST API (5.8.0 and newer). Take a look at this connect form

activemq-hawtio1

You can notice that management API uses /api/jolokia/ path and that by default ActiveMQ web server is listening on port 8161. Just click Connect to remote server and you’ll have the access to the broker.

activemq-hawtio2

The nice thing is that you can save different broker settings in the application, so it’s easy to connect to any of the brokers you have in your environment with the single click.

activemq-hawtio3

So, if you’re a Chrome user or willing to use Chrome apps in this way, there’s really nothing stopping you from accessing remote brokers from your local HawtIO instance.

If this solution is not ideal for you, you can always embed the console back in your ActiveMQ installation. Luckily, it’s very easy thing to do.

First, you need to download Hawtio default war, presumably in the webapps/ directory of your installation:

cd webapps
wget http://central.maven.org/maven2/io/hawt/hawtio-default/1.3.1/hawtio-default-1.3.1.war

Now, add appropriate web application context to the web server, by adding something like:

<bean class="org.eclipse.jetty.webapp.WebAppContext">
    <property name="contextPath" value="/hawtio" />
    <property name="war" value="${activemq.home}/webapps/hawtio-default-1.3.1.war" />
    <property name="logUrlOnStart" value="true" />
</bean>

to the etc/jetty.xml

The final step is to configure HawtIO authentication and adjust it to the broker’s one. This is done by providing the following system properties:

-Dhawtio.realm=activemq -Dhawtio.role=admins 
-Dhawtio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal

The easiest way to do it, is to add them to the ACTIVEMQ_OPTS variable in the bin/activemq startup script.

Now, run your broker and enjoy the hawtness.

Finally, if you’re interested in a great platform for running ActiveMQ and other integration technologies (HawtIO included), you should definitely give fabric8 a try. It provides an easy way to provision, configure and manage vast array of integration endpoints (broker included).

Or if you prefer standalone broker installation, you can try RedHat distributions that still come with the HawtIO included by default.

So, even if HawtIO is not distributed with ActiveMQ, you can easily use it in number of different setups depending solely on your preference.

Published at DZone with permission of Dejan Bosanac, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)