Aug 5, 2013

How to connect to the JBoss 7.1 internal Message Broker HornetQ ( JMS-Implemention ) with HermesJMS

HermesJMS is a GUI-Client for JMS. The acutal Version 1.14 can connect but
closes the connection after every sent message.  To let the connection open or reconnect, This is solved in Bug 184, which contains the link to Version 1.15, which reopens the JMS connection afer sending.

JBoss only has JMS active, if started with the standalone-full.xml configuration.

<JBOSS_HOME>/bin/standalone.sh -c standalone-full.xml

There you configure your queue, have to add an user in the application realm with the group guest and configure security domain other:

                <security-domain name="other" cache-type="default">
                    <authentication>
                        <login-module code="Remoting" flag="optional">                                                         
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                        <login-module code="RealmUsersRoles" flag="required">
                            <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
                            <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
                            <module-option name="realm" value="ApplicationRealm"/>
                            <module-option name="password-stacking" value="useFirstPass"/>
                            <module-option name="unauthenticatedIdentity" value="guest"/>
                        </login-module>
                    </authentication>
                </security-domain>


This is only for testing on my side, so for security reasons, this might be wrong.

First you have to create a session and a Classpath-Group with the JBoss-Client-jar:


Choose the tab below to configure the JBoss-Classpath-Group:

Select the jboss-client.jar and change back to the session-tab.
Here name the session and set the Connection-Factory and the loader. 
The properties can be found in the image. the initialContextFactory is:
org.jboss.naming.remote.client.InitialContextFactory



In the Destinations add a queue you have configured in the standalone-full.xml configuration.




For the queue I had also to set the username/password from JBoss, because otherwise I didn't get a connection to the queue. 


When you have the queue, select it from the session and double-click it, to get it. After this, select the queue with a right-click and select New Message as shown below.


 After getting the dialog, you can set the properties for the message and depending on the select type of message, the payload tab contains the input form for the data.


With Version 1.15 the dialog keeps open and the message can be resent multipel times, without error. Version 1.14 closes the connection after the first sending and issues an error afterwards.