In the attached example application, the three MDBs use the SenderEJB to send JMS messages to an ActiveMQ queue. In this example, I will be explaining how to:
In the ejb-jar.xml deployment descriptor, the SenderEJB is declared as follows:
The jms/MyQueueConnectionFactory is the JNDI name the SenderEJB will use to lookup a javax.jms.QueueConnectionFactory. We will configure it to point to an ActiveMQ QueueConnectionFactory.
The jms/LogQueue is the JNDI name the SenderEJB will use to lookup the javax.jms.Queue it will send messages to. We use the message-destination-link element to refer to the LoggingQueue which is declared in the assembly-descriptor section of the ejb-jar.xml deployment descriptor as:
This is a standard EJB deployment descriptor, nothing special.
panacya-jms-ds.xml – The JBoss Data Source File
This first snippet configures the QueueConnectionFactory, declared above, and places it in JNDI at activemq/QueueConnectionFactory:
This second snippet configures the Queue, declared above, and places it in JNDI at activemq/queue/outbound:
In the panacya-jms-ds.xml file section shown above, the value of the Properties element is set to PhysicalName=queue.outbound. This value is the physical name of the ActiveMQ destination the SenderEJB will be sending messages to and not a JNDI name. In other words, the value of the PhysicalName property has no meaning to JBoss. It is purely an ActiveMQ setting.
jboss.xml – The JBoss Deployment Descriptor
This second snippet links the local queuefactoryref name to the global JNDI name java:/activemq/QueueConnectionFactory which was declared above:
The above example highlights the key configuration settings needed to enable EJBs deployed in JBoss to send JMS messages to an ActiveMQ destination.
You can try the above example, plus a few more, by downloading the activemq-jboss-test.zip file which contains the complete sample project.