The AS7 book!

JBoss Tuning

JBoss 5 book

No Registration required. Use your FB account to add comments to articles.

Twitter Button

Poll

Which is your favourite JSF library?
 
Top Programming Sites
Home JBoss AS JBoss JMS configuration

JBoss JMS configuration

Article Index
JBoss JMS configuration
Configuring JMS client libraries
All Pages
  

jboss jms configurationThe Java Messaging Service (JMS) has been implemented by means of different providers in the releases 4.x, 5.x and 6.x of JBoss application server. This tutorial explains how to configure and run some JMS destinations using a managed JMS environment (consumer located in JBoss AS) or a standalone JMS application.

 

 

The JMS API stands for Java Message Service Application Programming Interface, and it is used by applications to send asynchronous business-quality messages to other applications. In the messaging world, messages are not sent directly to other applications. Instead, messages are sent to destinations, known as queues or topics.

 

Applications sending messages do not need to worry if the receiving applications are up and running, and conversely, receiving applications do not need to worry about the sending application's status. Both senders, and receivers only interact with the destinations.

The JMS API is the standardized interface to a JMS provider, sometimes called a Message Oriented Middleware (MOM) system.

 

In order to run a JMS application on JBoss AS you need to configure:

 

  • The JMS destionation on JBoss AS
  • The JMS libraries on the client

 

Configuring JMS destinations on JBoss

 

Case 1: JBoss AS 7 (Hornet Q)

JBoss AS 7 JMS destinations can be configured either by adding them in the core configuration file (standalone.xml/domain.xml) or via the CLI

Via CLI:

Add JMS queue:

add-jms-queue --name=queue1 --entries=queues/queue1


Add JMS topic:

add-jms-topic --name=topic1 --entries=topics/topic1

 

Via the configuration file:

<subsystem xmlns="urn:jboss:domain:messaging:1.1">
 <hornetq-server>
    . . . . . . . . . . .
    <jms-destinations>
       <jms-queue name="testQueue">
           <entry name="queue/test"/>
       </jms-queue>
       <jms-topic name="testTopic">
           <entry name="topic/test"/>
       </jms-topic>
    </jms-destinations>
 </hornetq-server>
</subsystem>

Case 2: JBoss AS 6 (HornetQ)

HornetQ configuration is located in JBoss 6 in deploy\hornetq.sar. You can add new Topic/Queues by adding them into hornetq-jms.xml file.

<queue name="testQueue">
  <entry name="/queue/queueA"/>
</queue>

<topic name="testTopic">
  <entry name="/topic/topicA"/>
</topic>


Case 3: JBoss AS 5 (JBoss Messaging)
If you are running JBoss 5, which ships with JBoss messaging you can add the following XML (-service.xml) to your deploy folder:

<mbean code="org.jboss.jms.server.destination.QueueService"
 name="jboss.messaging.destination:service=Queue,name=queueA"
 xmbean-dd="xmdesc/Queue-xmbean.xml">
  <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
  <depends>jboss.messaging:service=PostOffice</depends>
</mbean>

<mbean code="org.jboss.jms.server.destination.TopicService"
 name="jboss.messaging.destination:service=Topic,name=topicA"
 xmbean-dd="xmdesc/Topic-xmbean.xml">
  <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
  <depends>jboss.messaging:service=PostOffice</depends>
</mbean>   


Case 4: JBoss AS 4 (JBoss MQ)
If you using JBoss older JMS provider, you can add the following XML (-service.xml) to your deploy folder:
 <mbean code="org.jboss.mq.server.jmx.Queue"
 name="jboss.mq.destination:service=Queue,name=queueA">
  <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>

<mbean code="org.jboss.mq.server.jmx.Topic"
 name="jboss.mq.destination:service=Queue,name=topicA">
  <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>