Versions Compared

Key

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

The WSO2 JMS transport can be configured with IBM® WebSphere® MQ. The following topics cover the configuration steps.

Table of Contents
maxLevel3
minLevel3
 

...

Creating queue manager, queue and channel in IBM WebSphere MQ

  1. Start IBM WebSphere MQ Explorer as an administrator. If you are not running on an administrator account, right-click on the IBM WebSphere MQ icon/menu item and then click Run as Administrator.
  2. Right-click on Queue Managers, move the cursor to New and then click Queue Manager to open the Create Queue Manager wizard. Enter ESBQManager as the queue manager name. Make sure you select the make this the default queue manager check box. Leave the default values unchanged in the other fields. Click Next to move to the next page. 
  3. Click Next on the page for entering data and log values without changing any default values.
  4. On the page for entering configuration options, specify the configuration options as done in the following diagram, and click Next.
     
  5. Configure the following in the page for entering listener options.

    Field NameValue
    Create listener configured for TCP/IP check boxSelect this check box to create the listener.
    Listen on port number fieldEnter the number of the port where you want to set the listener. In this example, the port number will be 1414.
  6. Click Next and then click Finish to save the configuration. The queue manager will be created as shown below.
  7. Expand the navigation tree of the ESBQManager queue manager in the navigation tree. Right-click on Queues, move the cursor to New and then click Local Queue to open the Create a Local Queue wizard. Enter the local queue name as LocalQueue1 and complete running the wizard. Leave the default values of all other fields unchanged, and click Finish to save the local queue. 
    Anchor
    Qmanager
    Qmanager
  8. Right-click on Channels, move the cursor to  New , and then click Server-connection Channel to open the Create a Server-connection Channel wizard. Enter myChannel as the channel name and click Next. Make sure that the value for the Transmission Protocol is TCP. Leave the default values unchanged for the rest of the fields, and click Finish to save the channel.

...

Code Block
runmqsc ESBQManager
Code Block
ALTER QMGR CHLAUTH(DISABLED)

The following will be displayed in the command prompt.

 


Configuring WSO2 ESB JMS transport

...

Code Block
languagexml
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="MyJMSProxy"
       transports="jms"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <log level="full"/>
         <drop/>
      </inSequence>
   </target>
   <parameter name="transport.jms.Destination">LocalQueue1</parameter>
</proxy>

 


Testing the proxy service

...

The message will be logged in the ESB Management console as well as the log file. 


Sample Scenarios

This section describes how to configure the following sample scenarios using the JMS transport, WebSphere MQ, and WSO2 ESB:

...

  1. In <ESB_HOME>\repository\conf\axis2\axis2.xml, comment out both the myTopicConnectionFactory parameter and the SQProxyCF parameter. It should look as shown below.

    Code Block
    languagehtml/xml
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <!--parameter name="myTopicConnectionFactory" locked="false"> 
          <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
          <parameter name="java.naming.provider.url" locked="false">file:/C:/JNDI-Directory</parameter>
          <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
          <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
          <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter--> 
    
        <!--parameter name="SQProxyCF" locked="false">
          <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
          <parameter name="java.naming.provider.url">file:/C:/JNDI-Directory</parameter>
          <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
          <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
          <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter-->
    
        <parameter name="default" locked="false">
          <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
          <parameter name="java.naming.provider.url" locked="false">file:/C:/JNDI-Directory</parameter>
          <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
          <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
          <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter>
    </transportReceiver>
  2. Start the ESB with the Sample 251 configuration using the following command. 
    wso2esb-samples.bat -sn 251

  3. Log into the ESB server management console at: https://localhost:9443/carbon/.
  4. Select Service Bus -> Source view and update the JMS URL as follows.
    jms:/JMS_QUEUE?transport.jms.ConnectionFactoryJNDIName=MQ_JMS_MANAGER&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&java.naming.provider.url=file:/C:/JNDI-Directory&transport.jms.DestinationType=queue&transport.jms.ConnectionFactoryType=queue &transport.jms.Destination=JMS_QUEUE
  5. Configure the proxy service as follows.

    Code Block
    languagehtml/xml
    <definitions xmlns="http://ws.apache.org/ns/synapse">
      <proxy name="StockQuoteProxy" transports="https http jms" startOnLoad="true" trace="disable">
        <target>
          <endpoint>
            <address uri="jms:/JMS_QUEUE?transport.jms.ConnectionFactoryJNDIName=MQ_JMS_MANAGER&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&java.naming.provider.url=file:/C:/JNDI-Directory&transport.jms.DestinationType=queue&transport.jms.ConnectionFactoryType=queue&transport.jms.Destination=JMS_QUEUE"/>
          </endpoint>
          <inSequence>
            <property name="TRANSPORT_HEADERS" scope="axis2" action="remove"/>
            <property name="OUT_ONLY" value="true"/>
          </inSequence>
          <outSequence>
            <send/>
          </outSequence>
        </target>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
      </proxy>
      <sequence name="fault">
        <log level="full">
          <property name="MESSAGE" value="Executing default "fault" sequence"/>
          <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
          <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
        </log>
        <drop/>
      </sequence>
      <sequence name="main">
        <log/>
        <drop/>
      </sequence>
    </definitions>
  6. Comment out myTopicConnectionFactory and uncomment SQProxyCF in the <ESB_HOME>\samples\axis2Server\repository\conf\axis2.xml file as follows. 

    Code Block
    languagehtml/xml
      <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <!--parameter name="myTopicConnectionFactory" locked="false"> 
        <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">file:/C:/JNDI-Directory</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
         <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
         <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter-->
    
        <parameter name="SQProxyCF" locked="false">
         <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
         <parameter name="java.naming.provider.url">file:/C:/JNDI-Directory</parameter>
         <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
         <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
         <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter>
    
        <parameter name="default" locked="false"> 
        <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">file:/C:/JNDI-Directory</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
         <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
         <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter>
      </transportReceiver>
  7. Start the axis2 Server with the following command.
    axis2Server.bat  

  8. Add the following parameters to service.xml in <ESB_HOME>\samples\axis2Server\repository\services\SimpleStockQuoteService.aar.

    Code Block
    <parameter name="transport.jms.ConnectionFactory">SQProxyCF</parameter>
    <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
  9. Send the request from the JMS client, and the sample Axis2 server console will print a message as follows.

    Code Block
    languagenone
    ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=placeorder -Dsymbol=MSFT 

Topic Scenario 1: Client to Topic to ESB
Anchor
TopicScenario1
TopicScenario1

In this scenario, the JMS client places an order on the topic ivtT. The ESB listens to this topic, gets the message, and sends it to the back-end server to process the request.  

  1. In <ESB_HOME>\repository\conf\axis2\axis2.xml , uncomment the myTopicConnectionFactory parameter and comment out the SQProxyCF parameter. It should look as shown below.

    Code Block
    languagexml
      <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <parameter name="myTopicConnectionFactory" locked="false"> 
        <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">file:/C:/JNDI-Directory</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
         <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
         <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter>
    
        <!--parameter name="SQProxyCF" locked="false">
         <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
         <parameter name="java.naming.provider.url">file:/C:/JNDI-Directory</parameter>
         <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
         <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
         <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter-->
    
        <parameter name="default" locked="false"> 
        <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">file:/C:/JNDI-Directory</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
         <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
         <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
        </parameter>
      </transportReceiver>
  2. Start the ESB with the  Sample 250 configuration  by running the following command. 
    wso2esb-samples.bat -sn 250  
     

  3. Log in to the server management console at: https://localhost:9443/carbon/.

  4. Click web services -> list -> StockQuoteProxy -> edit (Specific Configuration)  

  5. Add a service parameter as follows and save it. 
    name = transport.jms.ConnectionFactory value = myTopicConnectionFactory

  6. Go to the <ESB_HOME>/samples/axis2Client directory and build it using the ant command.  

  7. Go to the <ESB_HOME>/samples/axis2Client /src/samples/userguide directory, open the GenericJMSClient.java source file, and make the following changes in the code.

    1. Set the jms_dest property default value to ivtT (line 45)

    2. Set the java.naming.provider.url to file:/C:/JNDI-Directory" (line 82)

    3. Set the java.naming.factory.initial to com.sun.jndi.fscontext.RefFSContextFactory (line 85)

    4. Set the lookup key to MQ_JMS_MANAGER (line 89)

  8. Configure the proxy configuration so that it appears as follows.

    Code Block
    languagehtml/xml
    <definitions xmlns="http://ws.apache.org/ns/synapse">
      <proxy name="StockQuoteProxy" transports="https http jms" startOnLoad="true" trace="disable">
        <target>
          <endpoint>
            <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
          </endpoint>
          <inSequence>
            <property name="OUT_ONLY" value="true"/>
          </inSequence>
          <outSequence>
            <send/>
          </outSequence>
        </target>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
        <parameter name="transport.jms.ContentType">
          <rules>
            <jmsProperty>contentType</jmsProperty>
            <default>application/xml</default>
          </rules>
        </parameter>
        <parameter name="transport.jms.ConnectionFactory">myTopicConnectionFactory</parameter>
      </proxy>
      <sequence name="fault">
        <log level="full">
          <property name="MESSAGE" value="Executing default "fault" sequence"/>
          <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
          <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
        </log>
        <drop/>
      </sequence>
      <sequence name="main">
        <log/>
        <drop/>
      </sequence>
    </definitions>
  9. Comment out the non-default connection factories in the <ESB_HOME>\samples\axis2Server\repository\conf\axis2.xml file so that it looks as follows.

    Code Block
    languagehtml/xml
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
      <!--parameter name="myTopicConnectionFactory" locked="false">
        <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">file:/C:/JNDI-Directory</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
        <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
        <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
      </parameter-->
    
      <!--parameter name="SQProxyCF" locked="false">
        <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
        <parameter name="java.naming.provider.url">file:/C:/JNDI-Directory</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
        <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
      </parameter-->
    
      <parameter name="default" locked="false">
        <parameter name="java.naming.factory.initial" 
    locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">file:/D/JNDI-Directory</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter>
        <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        <parameter name="transport.jms.Destination">bogusq</parameter>
      </parameter>
    </transportReceiver>
  10. Start the axis2 server with the following command. 
    axis2Server.bat 

  11. Send the request from the JMS client, and the sample Axis2 server console will print a message.

...