You are viewing an older version of this section. Click here to navigate to the latest version.

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:

<mule xmlns=""      xmlns:xsi=""      xmlns:spring=""      xmlns:jms=""      xsi:schemaLocation="">    <spring:bean name="connectionFactory" class="com.sun.messaging.ConnectionFactory"/>    <jms:connector name="JMSConnector"                   connectionFactory-ref="connectionFactory"                   specification="1.1"/></mule>

JNDI Connection

To create a JNDI connection, take the following steps:

  1. Configure Open MQ using the instructions from Sun here. 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.

  2. 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=""      xmlns:xsi=""      xmlns:spring=""      xmlns:jms=""      xsi:schemaLocation="">    <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>
  1. You need to put imq.jar and fscontext.jar from the $OPENMQ_HOME/lib on your classpath.