Home > Apache Geronimo v1.0 > Documentation > Apache Geronimo v1.0 - User's Guide > Integrating A Third Party JMS Provider |
Apache Geronimo is bundled with an open source messaging provider called Active MQ. ActiveMQ supports JMS API and J2EE applications deployed in Geronimo can use the messaging capabilities of ActiveMQ by means of JMS. In the following article you will learn how to configure another third party messaging provider that supports JMS specification with Geronimo. The article includes two sample scenarios using OpenJMS, another open source messaging provider, and IBM WebSphere MQ as messaging provider.
Geronimo 1.0
Websphere MQ 6.0
OpenJMS 0.7.7
Any third party JMS provider can be integrated with Geronimo by means of a JCA 1.5 resource adapter for JMS. The JMS RA wraps JMS API for creating connections to Queue's or Topic's and also provides Inbound Communication from a Queue or Topic.
The properties for the Resource Adapter are configured in the ra.xml. These properties are:
The geronimo-ra.xml contains Apache Geronimo specific properties for resource adapter. The following example shows an excerpt from the geronimo-ra.xml.
<outbound-resourceadapter> ... <connection-definition> <connectiondefinition-instance> <name>JMSQueueFactory</name> <config-property-setting name="url"></config-property-setting> <config-property-setting name="icf"></config-property-setting> <config-property-setting name="name"></config-property-setting> <connectionmanager> ... </connection-definition> <adminobject> ... <adminobject-instance> <message-destination-name>ivtQ</message-destination-name> <config-property-setting name="PhysicalName">queue1</config-property-setting> </adminobject-instance> </adminobject> <adminobject> <adminobject-instance> <message-destination-name>ivtT</message-destination-name> <config-property-setting name="PhysicalName">topic1</config-property-setting> </adminobject-instance> </adminobject> ...
geronimo-ra.xml can be used to configure instances of resource adapters for different JMS providers. The example at the end of this article has two such configurations for OpenJMS and WebsphereMQ. The connection definition properties are changed for different JMS providers. The outbound communication of Resource Adapter uses these properties to get a connection factory and create connections to Queue or Topic.
This section shows how to deploy a JMS Resource Adapter and configure a J2EE application to use OpenJMS and WebSphereMQ as JMS providers. RA can be deployed in the server scope and instances can be used within scope of application.
The following steps show how to deploy the JMS Resource Adapter and configure OpenJMS and WebSphereMQ providers for Geronimo.
OpenJMS starts RMI naming server on port 1019. This will conflict with the default RMI naming port in Geronimo. You will have to change the configuration for OpenJMS to use a different port and then start the OpenJMS server. Create QueueConnectionFactory and TopicConnectionFactory objects for OpenJMS. Define Queue's and Topics in openjms.xml. The following example shows relevant sections of the configuration file.
... <Connector scheme="rmi"> <ConnectionFactories> <QueueConnectionFactory name="JmsQueueConnectionFactory" /> <TopicConnectionFactory name="JmsTopicConnectionFactory" /> <QueueConnectionFactory name="openJMSQCF" /> <QueueConnectionFactory name="openJMSTCF" /> </ConnectionFactories> </Connector> ... <RmiConfiguration embeddedRegistry="true" registryHost="localhost" registryPort="1030"/> ... <AdministeredDestinations> <AdministeredTopic name="topic1"> <Subscriber name="sub1" /> <Subscriber name="sub2" /> </AdministeredTopic> <AdministeredQueue name="queue1" /> <AdministeredQueue name="queue2" /> <AdministeredQueue name="queue3" /> </AdministeredDestinations>
Deploy a JMS Resource Adapter with server scope.
java -jar <geronimo_home>\bin\deployer.jar <sample_home>\externaljms-1.0.rar
Deploy an enterprise application that uses OpenJMS.
java -jar <geronimo_home>\bin\deployer.jar <sample_home>\externaljms.ear <sample_home>\geronimo-application-openjms.xml
externaljms-1.0.rar, externaljms.ear and geronimo-application-openjms.xml are available for download in the Attachments section. You may want to download these files into a <sample_home> directory. |
The following example shows sections of Geronimo application plan for using OpenJMS. The properties for Outbound and Inbound communication are specified in the Message Bean and the Connector.
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application" configId="jms.ear" parented="jms.rar"> <module> <web>GERJMSWAR.war</web> ... </web-app> </module> <module> <ejb>GERJMSEJB.jar</ejb> ... <message-driven> <ejb-name>JMSMDB</ejb-name> <resource-adapter> <resource-link>JMSRA_1</resource-link> </resource-adapter> <activation-config> <activation-config-property> <activation-config-property-name>url</activation-config-property-name> <activation-config-property-value> tcp://localhost:3035 </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>icf</activation-config-property-name> <activation-config-property-value> org.exolab.jms.jndi.InitialContextFactory </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>name</activation-config-property-name> <activation-config-property-value> openJMSQCF </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name> destination </activation-config-property-name> <activation-config-property-value> queue1 </activation-config-property-value> </activation-config-property> </activation-config> </message-driven> </enterprise-beans> </openejb-jar> </module> <ext-module> <connector>JMSRA_1</connector> <external-path>jms/externaljms/1.0/rar </external-path> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector" configId="jms.rar.1" ``parentId="jms.ear"> <resourceadapter> ... <outbound-resourceadapter> <connection-definition> <connectionfactory-interface> org.apache.geronimo.jms.connector.JMSQueueConnectionFactory </connectionfactory-interface> <connectiondefinition-instance> <name>JMSQueueFactory</name> <config-property-setting name="url"> tcp://localhost:3035 </config-property-setting> <config-property-setting name="icf"> org.exolab.jms.jndi.InitialContextFactory </config-property-setting> <config-property-setting name="name"> openJMSTCF </config-property-setting> <connectionmanager> <no-transaction /> <no-pool /> </connectionmanager> </connectiondefinition-instance> </connection-definition> <connection-definition> ... </connection-definition> </outbound-resourceadapter> </resourceadapter> <adminobject> <adminobject-interface>javax.jms.Queue</adminobject-interface> <adminobject-class> org.apache.geronimo.jms.connector.JMSQueueImpl </adminobject-class> <adminobject-instance> <message-destination-name>ivtQ</message-destination-name> <config-property-setting name="PhysicalName"> queue1 </config-property-setting> </adminobject-instance> </adminobject> <adminobject> ... </adminobject> </connector> <ext-module> </application>
The properties configured in the geronimo-application.xml plan are:
Web Application
EJB Application
Resource Adapter Instance
The following steps describe how you need to configure WebSphereMQ.
The RA for JMS does not support XA. This can be added to make WebsphereMQ or OpenJMS part of distributed transactions in Geronimo.
There is a sample GenericJMS RA with XA support available in Sun java.net. This RA can be deployed in Geronimo to get XA support for JMS Providers. Visit the following link for further details, http://genericjmsra.dev.java.net
Resource Adapter - RA
WebsphereMQ - WMQ
Message Driven Bean - MDB
externaljms.ear - EAR application and Source Code that contains WAR for Outbound and MDB for Inbound from RA
externaljms-1.0.rar - JMS Rresource adapter and Source Code.
geronimo-application-mq.xml - Geronimo plan for MQ.
geronimo-application-openjms.xml - Geronimo plan for OpenJMS.