Section 7.10. Deploying JMS Destinations on JBoss


7.10. Deploying JMS Destinations on JBoss

JBoss implements and manages JMS Queues and Topics as JMX MBeans that create the Destination and register its JNDI name. Here are a few options for creating an MBean for our Queue:


The JMX console

Go to the JMX Console by visiting the following URLhttp://localhost:8080/jmx-console. Click on the service=DestinationManager link (under the jboss.mq heading) to see the JBossMQ DestinationManager MBean page. Look for the createQueue( ) operation and enter jms/CreditCheckQueue for the first parameter (the J2EE JNDI name would then be java:comp/env/jms/CreditCheckQueue), and queue/CreditCheckQueue for the second parameter (the JBoss-specific JNDI name). Using the JMX console is easy and provides a dynamic way to specify JMS resources, but your settings will be lost once you shut down JBoss.


Add an <mbean> element for the queue to $JBOSS_HOME/server/default/deploy/jms/jbossmq-destinations-service.xml file.

This file is part of the core JBoss deployment and contains JBoss-specific default test Queues and Topics.


Create your own service descriptor file (post-fixed with -service.xml) that resides in $JBOSS_HOME/server/default/deploy and add an <mbean> element for the queue.

This is a custom file that you create either by hand or with an automated tool as part of your build and deployment process.

We created our own service file because we wanted your JMS destination settings to survive JBoss startup/shutdown, and we didn't want to co-mingle your application-specific JMS Destinations with JBoss-internal Destinations. Co-mingling destinations is bad because each time you upgrade to a new version of JBoss, you have to re-add the <mbean> elements to your service descriptor to make things work again. Example 7-9 shows the jaw-jms-destinations.xml file that creates an MBean for the CreditCheckQueue.

Example 7-9. jaw-jms-destinations.xml
 <?xml version="1.0" encoding="UTF-8"?> <server>     <mbean code="org.jboss.mq.server.jmx.Queue"            name="jboss.mq.destination:service=Queue,name=CreditCheckQueue">       <depends optional-attribute-name="DestinationManager">          jboss.mq:service=DestinationManager       </depends>     </mbean> </server> 

To deploy our Queue to JBoss, the Ant build script copies the jaw-jms-destinations-service.xml file from the ch07/src/META-INF directory to the JBoss deployment directory$JBOSS_HOME/server/default/deploy.



JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net