Wednesday, 8 August 2018

Enabling remote (out of container) jms client connection to JBoss 8.2 with embedded HornetQ 2.4.5

Enable your messaging subsystem by using the standalone-full.xml configuration file that is already provided in the installation.

Launch your Widlfy container by pointing to your standalone-full.xml, instead of standalone.xml configuration file :

       
standalone.bat -c=standalone-full.xml


Call the  [your-jboss-installation-directory]/bin/add-user command, add an application user guest with the role of guest :

       
C:\work\development\jboss-as-7.1.0.Final\bin>add-user.bat
Picked up _JAVA_OPTIONS: -Duser.home=C:\Users\dubduan

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : guest
Password recommendations are listed below. To modify these restrictions edit th
 add-user.properties configuration file.
 - The password should not be one of the following restricted values {root, adm
n, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s)
 1 digit(s), 1 non-alphanumeric symbol(s)
 - The password should be different from the username
Password :
JBAS015266: Password must have at least 1 digit.
Are you sure you want to use the password entered yes/no? yes
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated
list, or leave blank for none)[  ]: guest
About to add user 'guest1' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'guest1' to file 'C:\work\applications\wildfly-8.2.0.Final\standalon
\configuration\application-users.properties'
Added user 'guest1' to file 'C:\work\applications\wildfly-8.2.0.Final\domain\co
figuration\application-users.properties'
Added user 'guest1' with groups guest to file 'C:\work\applications\wildfly-8.2
0.Final\standalone\configuration\application-roles.properties'
Added user 'guest1' with groups guest to file 'C:\work\applications\wildfly-8.2
0.Final\domain\configuration\application-roles.properties'
Is this new user going to be used for one AS process to connect to another AS p
ocess?
e.g. for a slave host controller connecting to the master or for a Remoting con
ection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition ret value="cGFzc3dvcmQ=" />
Press any key to continue . . .





Edit the file [your-jboss-installation-directory]/standalone/configuration/standalone-full.xml, disable security by adding the security-enabled tag :

       


<subsystem xmlns="urn:jboss:domain:messaging:1.1">

<hornetq-server>

<security-enabled>false</security-enabled>

.

.

.

<subsystem>



Make sure to export both your factory and your queue. For example in this case the exported factory is jms/RemoteConnectionFactory. The exported factory is already provided by default, however the an exported default queue is not. Create jms/queue/test queue:



<subsystem xmlns="urn:jboss:domain:messaging:1.1">

<hornetq-server>

.

.

.

   <jms-connection-factories>
.

.

.

   <connection-factory name="RemoteConnectionFactory">
                       <connectors>
                           <connector-ref connector-name="http-connector"/>
                        </connectors>
                       <entries>
                           <entry name="RemoteConnectionFactory"/>
                           <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                        </entries>
                    </connection-factory>
   </jms-connection-factories>
   <jms-destinations>
          <jms-queue name="testQueue">
                        <entry name="queue/test"/>
                        <entry name="java:jboss/exported/jms/queue/test"/>
          </jms-queue>
   </jms-destinations>

.

.

.

<subsystem>

Here are JMS connection attributes required for connection above (queue name, user, and password are yours to put):

       
initialContextFactory =  org.jboss.naming.remote.client.InitialContextFactory
url =  http-remoting://localhost:8080
connectionFactory = jms/RemoteConnectionFactory
queue.jndiQueuName = jms/queue/test
user = guest
password = password

No comments:

About Me

My Photo