Wednesday, December 27, 2017

How to Integrate WSO2 ESB with WSO2 MB as a Message Broker

This post will describe how to integrate WSO2 ESB with WSO2 Message Broker. This will provide the configuration required for ESB to connect to the Message Broker.

I am using the WSO2 EI 6.1.1 since It has both Integrator and Broker product reside as the profiles.


First we need to start the message broker. Message broker profile can be found under EI_HOME/wso2/broker directory.

1) Start the the message broker by executing the broker.sh in ESB_HOME/bin
     sh broker.sh
As an alternative, you can start the broker by executing the wso2server.sh under EI_HOME/wso2/broker/bin directory. Both will do the same thing that message broker starts.


Now Message broker is up and running. We need to configure the Integrator(ESB) with the broker details.

2) Add the below configuration in jndi.properties file under the EI_HOME/conf directory if they are not exist. The configuration has the host name and the ports information where broker is running.

 connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5675'  
 connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5675'  
 
3) Enable the JMS transport listener and sender configuration in axis2.xml of the Integrator. It can be found on EI_HOME/conf/axis2/axis2.xml
  by default It is commented out. So It has to be enabled as bellow.
  The java.naming.provider.url define the conf/jndi.properties and according to the configuration
  in jndi.properties file we have configured above, Integrator will connect with the broker.

 <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">  
     <parameter name="myTopicConnectionFactory" locked="false">  
       <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>  
       <parameter name="java.naming.provider.url" locked="false">conf/jndi.properties</parameter>  
       <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>  
       <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>  
     </parameter>  
     <parameter name="myQueueConnectionFactory" locked="false">  
       <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>  
       <parameter name="java.naming.provider.url" locked="false">conf/jndi.properties</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.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>  
       <parameter name="java.naming.provider.url" locked="false">conf/jndi.properties</parameter>  
       <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>  
       <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>  
     </parameter>  
   </transportReceiver>  

  <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>  

Now All the requied configuration has been done in Integrator. You can start the integrator.

4) Start the Integrator.
      go to the EI_HOME/bin and run the integrator.sh
      sh integrator.sh

The integrator is ready to consume message and publish message with WSO2 MB. You can deploy jms services such as JMS proxy service or Inbound Endpoint in ESB and They will consume messages from Message Broker.

1 comment:

  1. On that website page, you'll see your description, why not read through this. is it better to exchange currency abroad

    ReplyDelete