JMS on JBoss Configuration

Configuration files can be found in deploy/messaging directory of your JBoss server.

connection-factories-service.xml: Define connection factories

destinations-service.xml: Define destinations (Topic,Queue)

hsqldb-persistence-service.xml: Define persistence for messages (The messaging service stores all messages before delivering them)

jms-ds.xml: JMSProviderLoader and JmsXA inflow resource adaptor connection factory binding configuration

legacy-service.xml: JMSProviderLoader and JmsXA inflow resource adaptor connection factory binding configuration

messaging-jboss-beans.xml: Configures JMS security and management beans

messaging-service.xml: Contains the server’s configuration and core messaging services

remoting-bisocket-service.xml: Contains JMS remoting configuration

Configure JMS connection factories

New JMS connections are created by ConnectionFactory.

JBoss AS 5 ships already configured, non-clusterable and clusterable connection factories

Non-clustered are bound to the following JNDI contexts: /ConnectionFactory, /XAConnectionFactory, java:/ConnectionFactory, java:/XAConnectionFactory

Clustered are bound to the following JNDI contexts: /ClusteredConnectionFactory, /ClusteredXAConnectionFactory, java:/ClusteredConnectionFactory, java:/ClusteredXAConnectionFactory

Configuration located in deploy/messaging/connection-factories-service.xml

You can find an example on how to create a ConnectionFactory inside deploy/messaging/connection-factories-service.xml

Tip - Factories that are bound to the java: namespace are reserved for local JMS Client (running on the same JVM of the server)

Configure JMS destinations

The deploy/messaging/destinations-service.xml contains preconfigured destinations deployed during server startup

To create your own queue called exampleQueue, you could either add it to deploy/messaging/destinations-service.xml or deploy your own exampleQueue-service.xml:


<mbean code="org.jboss.jms.server.destination.QueueService"



<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>



Interested in mastering JBOSS?

Learn more about JBOSS Tutorial in this blog post.

Deploying it binds this queue to JNDI as /queue/exampleQueue:

13:27:57,421 INFO [QueueService] Queue[/queue/exampleQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000

Similarly, to create your own topic called exampleTopic, you could either add it to deploy/messaging/destinations-service.xml or create your own exampleTopic-service.xml:


<mbean code="org.jboss.jms.server.destination.TopicService"



<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>




Deploying it binds this topic to JNDI as /topic/exampleTopic:

13:27:57,890 INFO [TopicService] Topic[/topic/exampleTopic] started, fullSize=200000, pageSize=2000, downCacheSize=2000

You can inspect destination attributes via the JMX console in the jboss.messaging.destination domain.

Here is some information about attribute you can configure for a destination, for more info on the additional attributes, see

name: name of the queue

JNDIName: JNDI name where the queue is bound

DLQ: Dead Letter Queue to use. It’s a special destination where the messages are sent when the server has attempted to deliver them unsuccessfully more than a certain number of times

ExpiryQueue: is a special destinations where messages are sent when they have expired

RedeliveryDelay: redelivery delay to be used for this queue

MaxDeliveryAttempts: number of times a delivery attempt will happen before the message goes to the DLQ

SecurityConfig: Allows you to determine which roles can read, write and create on the destination

FullSize: maximum number of messages held by the queue or the topic in memory at any given time

For indepth understanding on JBoss click on: