GlassFish includes Sun’s implementation of JMS , known as OpenMQ . When developing SOA applications with Java CAPS or OpenESB , you will most probably end up using JMS queues and topics as loosely coupled communication mechanism between components of your application.
However, as great are GlassFish and OpenMQ, they lack a graphical tool allowing to browse queues and topic. Developing JMS applications without such a tool is a frustrating task, to say the least.
Here comes HermesJMS. Quoted from their web site :
|
“ HermesJMS is an extensible console that helps you interact with JMS providers making it easy to browse or search queues and topics, copy messages around and delete them. It fully integrates with JNDI letting you discover administered objects stored, create JMS sessions from the connection factories and use any destinations found” |
Configuring HermesJMS to connect to OpenMQ is not intuitive at all and I found very few resources on the web explaining how to do it.
At this stage, I would like to thank Michael Czapski and Thomas Barrett for having showed me the steps required to configure HermesJMS and for all the work they did to prepare a great CEC 2008.
Step 1 : Start Hermes JMS
The easiest way to start Hermes JMS is using Java Web Start. You can do that from their web site or using the icon below (requires Java SE 6+, if you have older versions of Java, other links are provided on Hermes JMS’ web site)
Note that it will only work if your Java MQ is installed to use default port 7676.
Step 2 : Create a JavaMQ session
Replace <new> with JavaMQ and click the Apply button.
Step 3 : Add Java MQ JARs files to the classpath
Click on the Providers Tab on the bottom of the screen, right click anywhere inside the Classpath Groups pane and choose Add Group.
Name the group JavaMQCLasspahGroup (or whatever meaningful name you want). Right-click on the long button called Library and choose Add JAR(s).
Navigate to your GlassFish application server’s imq/lib directory. For OpenESB installed to OPENESB_HOME it will be something like : $OPENESB_HOME\glassfish-v2-ur2-b04-patch-20080929\imq\lib
This should work whether the imq/lib comes from Java MQ 4.1, OpenESB installation, GlassFishESB installation or Java CAPS 6 installation.
Choose the 10 following JARs. Not all may be required by we did not spend the time figuring out the minimum necessary set.
-
fscontext.jar
-
imq.jar
-
imqadmin.jar
-
imqbroker.jar
-
imqjmx.jar
-
imqutil.jar
-
imqxm.jar
-
jaxm-api.jar
-
jhall.jar
-
jms.jar
Allow Hermes to scan the JARs.
Once the JARs are scanned the Library will list all the JARs. Click the Apply button. Your screen should now look like this :
Click on Apply, then OK
Right-click the JavaMQ session and choose Edit to open configuration dialogue again.
Pull down the Loader menu and choose the JavaMQClasspathGroup. Pull down the Class menu and choose the com.sun.messaging.QueueConnectonFactory class. Click OK
Step 4 : Add an existing JMS queue / topic to your session
The last step is to actually add the queues and topics you want to monitor
Right-click JavaMQ session and choose New->Add queue …
and be sure to choose the name of an existing queue or topic.
Step 5 : Enjoy browsing your queues and topics
Once the Java MQ session is configured and queues of interest are configured we can interact with the Java MQ broker, view messages in destinations, truncate destinations (delete all messages) and so on. The functionality of Hermes JSM can be used as required.
UPDATE : OpenMQ FAQ now has a topic on HermesJMS Integration. It also describes how to connect to a remote broker, not running on the localhost.
#1 by James on 15/11/2008 - 09:16
Hi Sebastien, thanks for this info – two questions:
– is it the same process for viewing vanilla OpenMQ queues?
– how do you point Hermes at a non localhost:7676 broker?
Thanks!
#2 by Marco on 17/11/2008 - 09:16
That would be great!
I would really love to use hermes with something different from a simple localhost! 🙁
Has anyone managed!?!?
Thanks in advance!
Marco
#3 by Sebastien Stormacq on 17/11/2008 - 12:29
Hello,
@ James : Yes this should work the same for OpenMQ and Java MQ
@ James, Marco : when specifying no properties, the defaults are taken : localhost and 7676.
When reading Java MQ doc, we learn that the property can be changed with
connectionFactory.setProperty(com.sun.messaging.ConnectionConfiguration.imqAddressList, "localhost:7676,broker2:5000,broker3:9999");
(see http://docs.sun.com/app/docs/doc/820-5205/aeqax?a=view)
Borowsing the source code (), it appears the constant value is "imqAddressList" …
My guess (to be tested) is therefore to add a imqAddressList property in HermesJMS session proprties to specify the name and port number of the broker you want to connect to….
Do not hesitate to report feedback either here in the comments or by email : I will update the post accordingly.
Cheers
#4 by Nike Made Jerseys on 19/09/2012 - 13:27
Thank you for your sharing. It is wonderful.