JMS Client using JBoss 7 – Publish/Subscribe Messaging

This example will take you through step by step on practical implementation how you can configure a JMS Client using JBoss Application Server 7.1.1. I won’t discuss theoretical part here but if you need to know JMS related various keywords then you can go through the tutorial at

Publish/Subscribe Messaging System

  • In a publish/subscribe (pub/sub) messaging system, clients address messages to a topic.
  • Each message may have multiple consumers.
  • Publishers and subscribers have a timing dependency. A client that subscribes to a topic can consume only messages published after the client has created a subscription, and the subscriber must continue to be active in order for it to consume messages.


JBoss Application Server 7.1.1
JDK 1.6
Jar – jboss-client.jar (located at <JBOSS_HOME>\bin\client)

We will see now step by step implementation of JMS client

Step 1. Run the JBoss application server using the below command from command prompt. Open command prompt, navigate to <JBOSS_HOME>\bin and execute the below command. The below command will run the application server. You can stop the server by pressing “Ctrl+C” and then type “Terminate batch job (Y/N)? y”


Once the server is up and running you will see snippets of output at the bottom similar to the below


Step 2. Now we need to create a user for authentication or running the application. So we will create a guest user. So open command prompt, navigate to <JBOSS_HOME>\bin and execute the below command.


Enter the below inputs as shown in the screen-shot. You can give any username and password as per your choice. I have given here usernameuser and passwordkolkata

JMS Client using JBoss 7

Step 3. Now create a java project in Eclipse or any Java based IDE. Configure Eclipse using jboss-client.jar (located at <JBOSS_HOME>\bin\client) which is required for JMS application.

Step 4. We will create Message Publisher which will publish messages to the topic for Subscribers who will receive those messages from the topic.


Step 5. We will create Message Subscribers which will receive message from the topic.


Step 6. Now how did we get those ConnectionFactory and Destination(Topic) names in the above java codes. Navigate to the location <JBOSS_HOME>\standalone\configuration and open the xml file standalone-full.xml and look for tags <jms-connection-factories> and <jms-destinations>. You can also create and use your own ConnectionFactory or Destination. Also note that I have written “jms/RemoteConnectionFactory” instead of “RemoteConnectionFactory” and “jms/topic/test” instead of “topic/test” otherwise it won’t work.

Excert is given below from standalone-full.xml


Step 7. Now run and then run in order to get the output in the Subscriber’s console. You won’t get any output at console but you will see below output at and consoles


That’s all. Thanks for your reading.

One Reply to “JMS Client using JBoss 7 – Publish/Subscribe Messaging”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.