Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If your system has more than one existing brokers, it will be required to configure the JMS transport with multiple brokers. In such situations, each transport receiver should have a separate name. 

The following example illustrates how to configure the transport with both ActiveMQ and SwiftMQ as JMS brokers in the <ESB_Home>/repository/conf/axis2/axis2.xml file.

...

Configure the JMS transport with ActiveMQ by following the procedure in Configure with Active MQ. Enter the value for the transport receiver as jmsActiveMQ instead of jms as shown below.

Code Block
languagexml
 <transportReceiver name="jmsActiveMQ" class="org.apache.axis2.transport.jms.JMSListener">

...

WSO2 ESB to listen to both ActiveMQ and WSO2 MB messages.

  1. Download ActiveMQ (version 5.8.0 or later) from the Apache ActiveMQ site. Download the WSO2 Message Broker from the WSO2 Message Broker site.
  2. Copy the following client libraries from <AMQ_HOME>/lib directory to <ESB_HOME>/repository/components/lib directory.
    • activemq-broker-5.8.0.jar 
    • activemq-client-5.8.0.jar 
    • geronimo-jms_1.1_spec-1.1.1.jar 
    • geronimo-j2ee-management_1.1_spec-1.0.1.jar 
    • hawtbuf-1.9.jar 
  3. Copy the andes-client-0.13.wso2v10.jar from <MB_HOME>/client-lib directory to <ESB_HOME>/repository/components/lib directory.
  4. Configure the <ESB_HOME>/repository/conf/axis2/axis2.xml file as follows to enable ActiveMQ as a transport listener.

    Code Block
    languagexml
    <transportReceiver name="jmsSwiftMQjms1" class="org.apache.axis2.transport.jms.JMSListener">

     The configuration should look as follows.

    Code Block
    languagexml
    <!-- ActiveMQ -->
    <transportReceiver name="jmsActiveMQ" class="org.apache.axis2.transport.jms.JMSListener">
           <parameter name="T1ActivemQTopicConnectionFactorymyTopicConnectionFactory" locked="false">
               <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
               <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
               <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
                <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
           </parameter>
     
           <parameter name="T1DataJMSCachingConnectionFactorymyQueueConnectionFactory" locked="false">
               <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
               <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
               <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
                <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
           </parameter>
     
           <parameter name="default" locked="false">
               <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
               <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
               <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
                <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
           </parameter>
       </transportReceiver>
     
    

    Enter the following configuration in the same file to enable the WSO2 Message Broker.

    Code Block
    languagexml
    <!-- SwiftMQUncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x -->
       <transportReceiver name="jmsSwiftMQjms2" class="org.apache.axis2.transport.jms.JMSListener">
           <parameter name="T1SwiftTopicConnectionFactorymyTopicConnectionFactory" locked="false">
              <parameter name="java.naming.factory.initial" locked="false">com>org.wso2.swiftmqandes.jndi.InitialContextFactoryImpl<PropertiesFileInitialContextFactory</parameter>
               <parameter name="java.naming.provider.url" locked="false">smqp:>repository/conf/<jndi.properties</parameter>
               <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
    <parameter name="transport.jms.JMSSpecVersion" locked="false">1.0</parameter>           <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
           </parameter>
     
           <parameter name="T1SwiftQueueConnectionFactorymyQueueConnectionFactory" locked="false">
               <parameter name="java.naming.factory.initial" locked="false">com>org.wso2.swiftmqandes.jndi.InitialContextFactoryImpl<PropertiesFileInitialContextFactory</parameter>
               <parameter name="java.naming.provider.url" locked="false">smqp:>repository/conf/<jndi.properties</parameter>
               <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
    <parameter name="transport.jms.JMSSpecVersion" locked="false">1.0</parameter>
              <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
           </parameter>
     
           <parameter name="default" locked="false">
               <parameter name="java.naming.factory.initial" locked="false">com>org.wso2.swiftmqandes.jndi.InitialContextFactoryImpl<PropertiesFileInitialContextFactory</parameter>
               <parameter name="java.naming.provider.url" locked="false">smqp:>repository//internalip:host/type=com.swiftmq.net.JSSESocketFactory</parameter>
    conf/jndi.properties</parameter>
               <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
               <parameter name="transport.jms.JMSSpecVersionConnectionFactoryType" locked="false">1.0</parameter>
    <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
    </parameter>
    </transportReceiver> >queue</parameter>
           </parameter>
       </transportReceiver>
    Info

    Note that the transport receiver name is different in each configuration.

  5. Add a topic and a queue to the  jndi.properties file located in <ESB_HOME>/repository/conf as follows:

    Code Block
    languagejava
    <connection-factory name="QueueConnectionFactory">
          <xa>false</xa>
          <connectors>
             <connector-ref connector-name="netty"/>
          </connectors>
          <entries>
             <entry name="/QueueConnectionFactory"/>
          </entries>
    </connection-factory>
    
    
    <connection-factory name="TopicConnectionFactory">
          <xa>false</xa>
          <connectors>
             <connector-ref connector-name="netty"/>
          </connectors>
          <entries>
             <entry name="/TopicConnectionFactory"/>
          </entries>
    </connection-factory>
  6. Start both ActiveMQ and WSO2 MB.
  7. Start the WSO2 ESB server and the management console. If they are already running, restart them.

Now a proxy service can be created with reference to transport receiver JMS1 and/or JMS2. For example, the following proxy service is configured with reference to both transport receivers.

Code Block
languagexml
<proxy xmlns="http://ws.apache.org/ns/synapse" 
name="jmsMultipleListnerProxy" 
transports="jms1,jms2" 
statistics="disable" 
trace="disable" 
startOnLoad="true"> 
<target> 
<inSequence> 
<log level="full"/> 
<send> 
<endpoint> 
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/> 
</endpoint> 
</send> 
</inSequence> 
<outSequence> 
<send/> 
</outSequence> 
</target> 
<parameter name="transport.jms.ContentType"> 
<rules> 
<jmsProperty>contentType</jmsProperty> 
<default>application/xml</default> 
</rules> 
</parameter> 
<description/> 
</proxy>
Excerpt
hiddentrue

This content was added to answer question "How can I connect WSO2 ESB to multiple JMS brokers?" in the /wiki/spaces/FAQ/pages/37781616 FAQ page.