JMS configuration on JBoss
JMS on JBoss Configuration Configuration files can be found in the 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 pre-configured 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 example queue-service.xml:
<server><mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=exampleQueue"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
</mbean>
</server>
Deploying it binds this queue to JNDI as /queue/example queue: 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 example topic-service.xml:
<server><mbean code="org.jboss.jms.server.destination.TopicService"
name="jboss.messaging.destination:service=Topic,name=exampleTopic"
xmbean-dd="xmdesc/Topic-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
</mbean>
</server>
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 http://jboss.org/jbossmessaging/docs.html
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 destination 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 an in-depth understanding on JBoss click on: