Saturday, 11 August 2012

HermesJMS setup for HornetQ

The amount of free UI-based client software for the JBoss HornetQ messaging server/service is quite limited. One of the few and perhaps the best in this area is HermesJMS.
A simple documentation and various hints (community entries, blogposts etc) around the Internet for setting up HermesJMS with HornetQ do exist, but none are (IMHO) as straightforward and complete as they could be. 
To remedy this; here is a complete (?) step-by-step instruction to setup HermesJMS with HornetQ .
This setup has been validated on...
  • HermesJMS 1.15 on OSX 10.7, OSX 10.8 and Windows 8
  • HornetQ 2.2.5.Final (standalone), 2.2.14.Final (standalone), 2.3.0.CR1 (standalone), 2.3.0.Final (standalone) and JBoss AS 6.1.0.Final on both OSX 10.7, OSX 10.8, Ubuntu and RHEL
...all using Java SE 6.

Connecting to HornetQ from HermesJMS

To view the contents of topics/queues in a HornetQ instance, a session must be setup. To view various configuration data exposed by JMX from a HornetQ instance, a context must be setup.

Setup a session

Right-click the sessions node in the tree pane and select New -> New Session...
In the now showing Preferences window, select the Providers tab
Right-click and select Add Group
Give the group a name – e g HornetQ
For the new group, right-click Library and select Add JAR(s).
Select the following JARs – one at time. After a JAR is selected also click Scan. After all JARs are selected click Apply.
(for JBoss AS 6 in $JBOSS_HOME/client)
(for HornetQ 2.2.x.Final standalone in $HORNETQ_HOME/lib)
  • hornetq-core-client.jar
  • hornetq-jms-client.jar
  • jnp-client.jar
  • netty.jar
  • jboss-logging.jar (only needed for JBoss AS 6!)
  • hornetq-commons.jar (only needed as of HornerQ 2.3.0.x!)
Select the Sessions tab in the Preferences window.
Give the Session a name in the drop-down menu– e g HornetQ-Session - and click Apply.
As Plug In, select the HornetQ plugin from the drop-down (you might need to select HornetQ from the loader drop-down first).
Right-click in the Property-Value-pane. 
Select Add property. A line is now available. 
Click on it in the  Property-column and select jmxUrl
On the same line, in the Value-column, select it by double-clicking and enter the value service:jmx:rmi:///jndi/rmi://localhost:6000/jmxconnector
Note: adjust the path (hostname and port) as needed.
For the Connection Factory, select hermes.JNDIQueueConnectionFactory from the Class-drop-down and HornetQ (earlier created in the Providers tab) from the Loader-drop-down.
Right-click in the Property-Value-pane. 
Select Add property. A line is now available. 
Enter the following Property-Value-pairs.
  • binding - ConnectionFactory
  • initialContextFactory - org.jnp.interfaces.NamingContextFactory
  • providerURL - jnp://localhost:1099
  • urlPkgPrefixes - org.jboss.naming:org.jnp.interfaces
Note: adjust path (hostname) for providerURL as needed. 
It can sometimes be cumbersome to get values to "stick" during configuration. If you encounter some error, re-visit your configurations and make sure all(!) values are properly set before moving on. If they are not – try again! Setting them one-by-one clicking Apply and Ok and saving the configuration between each usually works.

Setup a context

Right-click the contexts node in the tree pane and select New -> New Context...
Give the session a name – e g HornetQ-Context.
In the now showing JNDI InitialContext window, set the following property-valiue-pairs:
  • loader - HornetQ
  • initialContextFactory - org.jnp.interfaces.NamingContextFactory
  • providerURL - jnp://localhost:1099
  • urlPkgPrefixes org.jboss.naming:org.jnp.interfaces
That should do it. Enjoy!

3 comments:

  1. Hi, very useful,thanks. One more thing: do not install Hermes/SoapUI-Hermes in a directory with space (ex: 'Program Files'). I had some issues because of this.

    ReplyDelete
  2. Hi, very useful guide especially the note about doing one change at a time.

    ReplyDelete
  3. Thanks for the very useful article. I'm having issues when monitoring queues with the watch feature. The statistics are not beeing updated. Can anybody help? I tried to change the configurations for the Watch under Options>>Configuration but it still no luck.

    ReplyDelete