<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd">
<spring:bean name="connectionFactory" class="com.sun.messaging.ConnectionFactory"/>
<jms:connector name="JMSConnector"
connectionFactory-ref="connectionFactory"
specification="1.1"/>
</mule>
Open MQ Integration
This page describes how to integrate Mule with the Open MQ JMS broker, the community version of Sun Java System Message Queue. It includes examples for configuring a direct connection and a JNDI connection.
Direct Connection
To create a direct connection, simply specify the connection factory and JMS connector as follows in your Mule configuration file:
JNDI Connection
To create a JNDI connection, take the following steps:
-
Configure Open MQ using the instructions from Sun. You must use the Open MQ or Message Queue Administration Console to define the connectionFactory (Factory type topic/queue connection factory) and to configure any Open MQ JMS endpoints you will specify in your Mule configuration file.
-
Configure the namespaces, JMS connector, Spring beans, and endpoints in your Mule configuration file as follows, ensuring that you include all the tags shown below:
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd"> <jms:connector name="jmsConnector" connectionFactory-ref="openMQ" specification="1.1"> <spring:property name="jmsSupport" ref="jndiJmsSupport" /> </jms:connector> <spring:beans> <spring:bean name="jndiJmsSupport" class="org.mule.transport.jms.Jms102bSupport"> <spring:constructor-arg ref="jmsConnector" /> </spring:bean> <spring:bean name="context" class="javax.naming.InitialContext"> <spring:constructor-arg type="java.util.Hashtable"> <spring:props> <spring:prop key="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory </spring:prop> <spring:prop key="java.naming.provider.url">file:///C:/pawan/openMQ/mq</spring:prop> </spring:props> </spring:constructor-arg> </spring:bean> <spring:bean name="openMQ" class="org.springframework.jndi.JndiObjectFactoryBean"> <spring:property name="jndiName" value="MyTopicConnectionFactory" /> <spring:property name="jndiEnvironment"> <spring:props> <spring:prop key="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory </spring:prop> <spring:prop key="specifications">1.1</spring:prop> <spring:prop key="java.naming.provider.url">file:///C:/Temp</spring:prop> </spring:props> </spring:property> </spring:bean> </spring:beans> <endpoint name="MyEndPoint" address="jms://topic:my_topic" connector-ref="jmsConnector"/> ... </mule>
-
You need to put
imq.jar
andfscontext.jar
from the$OPENMQ_HOME/lib
on your classpath.