ActiveMQ and HawtIO

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 lile

<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.

9 Responses to “ActiveMQ and HawtIO”

  • Linu Raj

    Hi Dejan,

    In case of ActiveMQ Master/Slave cluster, with replicatedLevelDB; is it possible to have a single hawtio url which talks to all members in the cluster.

    We are using AWS cloud as our platform. We have scripts which creates an ActiveMQ cluster. Along with this we want to automate the hawtio installation and configure it to display the cluster details. Is it possible?

    Thanks!

    Reply
    • Crishel Yumul

      Hi Linu Raj,

      Have you found the solution on this one? We happen to have the same technology (and configs) applied.

      Regards,
      Crishel

      Reply
  • Gerard Weatherby

    The article lists etc/jetty.xml — does that mean we cannot use the jetty.xml that’s in conf?

    Reply
    • Gerard Weatherby

      Never mind … just figured out it needs to go in the handlers section.

      Reply
  • yuri

    Doesn’t work here, I’m getting:

    HTTP/1.1 403 Forbidden
    X-Frame-Options: SAMEORIGIN
    Access-Control-Allow-Origin: *
    Content-Length: 0
    Server: Jetty(8.1.16.v20140903)

    when trying to authenticate with proper logins that work on /admin/ . I guess it’s unusable with activemq.

    Reply
  • Bennet Schulz

    Hi Dejan,

    tried to add hawtio to my standalone ActiveMQ installation as you described in this post, but it didn’t work. The problem was the location of the hawtio authentication properties. Instead of putting them into the activemq script in the bin folder, you have to put it into the env script which is also located in the bin folder of activemq. The properties won’t be available in hawtio when putting them into the activemq script.

    It took some time to find this issue and fix it, so I wrote a blog post about it. Hope someone else saves some time with it.
    You can find my solution here: http://www.bennet-schulz.com/2016/07/apache-activemq-and-hawtio.html

    cheers,
    Bennet

    Reply
  • Leave a Reply to Gerard Weatherby