Article donated by: Krishnakumar Balachandar (mailto:), Hernan Cunico
Apache Geronimo is bundled with an open source messaging provider called ActiveMQ. A J2EE application deployed on Geronimo can use Queue's and Topics created in ActiveMQ and a Message Driven Bean ( MDB ) can act as an endpoint to pick messages from a Queue or Topic. This article discusses how to use any other third party messaging product that supports JMS specification with Geronimo. The example used in this article uses IBM Websphere MQ ( WMQ ) as the messaging provider and a Resource Adapter ( RA ) is used to integrate MQ with Geronimo. The RA provides outbound communication to Queues and Topics. Inbound communication of RA picks message from a Queue and sends to MDB deployed in Geronimo.
Integrating IBM Websphere MQ in Apache Geronimo
The following list and figure illustrates the different components of Apache Geronimo and IBM Websphere MQ.
- WebSphere MQ Messaging Provider
- MQ RA resource adapter
- JNDI Bindings for MQ
- Message Driven Bean for Inbound Communication
- Servlet for Outbound Communication
WMQ contains Queue and Topic objects and Connection Factory is created in JNDI registry. A JCA RA is deployed in Geronimo that provides outbound and inbound communication to WMQ. Outbound communication from RA looks up connection factory from JNDI to create connections to Destination. For inbound communication MDB acts as an endpoint and RA polls MQ to pick messages and send to MDB.
MQ Resource Adapter
JCA RA deployed in Geronimo provides integration with MQ. The following example shows sections of the RA plan (ra.xml
) and config properties.
<outbound-resourceadapter> <config-property> <description>jndi provider</description> <config-property-name>url</config-property-name> <config-property-type>java.lang.String</config-property-type> </config-property> <config-property> <description>icf</description> <config-property-name>icf</config-property-name> <config-property-type>java.lang.String</config-property-type> </config-property> <config-property> <description>name</description> <config-property-name>name</config-property-name> <config-property-type>java.lang.String</config-property-type> </config-property> <outbound-resourceadapter> <inbound-resourceadapter> <activationspec> <required-config-property> <config-property-name>url</config-property-name> </required-config-property> <required-config-property> <config-property-name>icf</config-property-name> </required-config-property> <required-config-property> <config-property-name>name</config-property-name> </required-config-property> <required-config-property> <config-property-name>destination</config-property-name> </required-config-property> </activationspec> </inbound-resourceadapter> <adminobject> <config-property> <config-property-name>PhysicalName</config-property-name> <config-property-type>java.lang.String</config-property-type> </config-property> </adminobject> <adminobject> <config-property> <config-property-name>PhysicalName</config-property-name> <config-property-type>java.lang.String</config-property-type> </config-property> </adminobject>
The RA has the following configuration properties:
- Outbound
url - JNDI provider url (for example ldap://test/o=test,c=com, file\:/C:/JNDI-Directory)
icf - Initial Context Factory (for example com.sun.jndi.fscontext.RefFSContextFactory)
name - Factory Name (for example ivtQCF)
- Inbound
url - JNDI provider url.
icf - Initial Context Factory
name - Factory Name
destination - Destination to pick messages form (for example Queue Name)
- Administered Objects
Physical Name - name of queue or topic created in JNDI of Geronimo