Friday, July 9, 2010

WSO2 ESB and Qpid setup Guide

This document explains how to do ESB + Qpid setup from the scratch which includes setting up ESB/QPID and registry instances and this Guide doesn't contains any internal message flow configurations of ESB. In this setup we are forwarding incoming messages to Qpid from ESB1 and ESB2 instance is picking messages from the Qpid instance and forward to another endpoint. For this scenario I am just explaining on how to setup the initial configuration and will be posting on how to configure message flows of ESB instances.

1. Download Qpid from here http://www.apache.org/dist/qpid/0.6/qpid-java-0.6.tar.gz and extract Qpid and and open the QPID_HOME/etc/config.xml
change enable ssl false as below.

<management>
<enabled>true</enabled>
<jmxport>8999</jmxport>
<ssl>
<enabled>false</enabled>
<!-- Update below path to your keystore location, eg ${conf}/qpid.keystore -->
<keyStorePath>${prefix}/../test-profiles/test_resources/ssl/keystore.jks</keyStorePath>
<keyStorePassword>password</keyStorePassword>
</ssl>
</management>

2. If you want to use qpid in a clustering mode and extract another qpid instance and do the step 1 and edit QPID_HOME/etc/config.xml and change the ports
configuration by editing port and sslport elements.

<port>5673</port>
<sslport>8673</sslport>

3. Start Qpid by running QPID_HOME/bin/qpid-server. If you are using a cluster start all the instances.


Configuring ESB instance which is forwarding incoming messages to Qpid instance

1. Create a server.properties file in CARBON_HOME/repository/conf/ directory and add the following entries to the properties file.

connectionfactory.qpidConnectionfactory=amqp://guest:guest@clientid/test?brokerlist='tcp://10.3.24.99:5672'
destination.directQueue=direct://amq.direct//ServiceName
destination.replyQueue =direct://amq.direct//ServiceNameReply

In this configuration 10.3.24.99 is the IP address of the machine which Qpid is running and qpidConnectionfactory is a reference we are using for our reference in axis2.xml.

If you are using Qpid in a cluster please create another properties file and define the same configuration with a different file name and let's assume your slave configuration file is server1.properties.

2. Now open the CARBON_HOME/repository/conf/axis2.xml add the following entry

Adding transportRecievers

<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">/home/wso2/WSO2_SETUP1/wso2esb-3.0.0-1/repository/conf/server.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">qpidConnectionfactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="slave" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">/home/wso2/WSO2_SETUP1/wso2esb-3.0.0-1/repository/conf/server1.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">qpidConnectionfactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver>

Please change the java.naming.privider.url element according to your setup(colored in red).

Adding transportSenders

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

3. If you need only one Qpid instance please remove the second parameter list and keep the default configuration(parameter set with name="default") and note the name of the second parameter set is "slave" and
we need to use that configuration to be added in to synapse configuration when we configure failover endpoints.

4. Copy following jars in to CARBON_HOME/repository/components/lib directory and please download the merged jar from the given location and rest of the jars can be found in QPID_HOME/lib directory.
qpid-common-merged.jar http://people.apache.org/~lahiru/qpid-common-merged-0.6.jar
qpid-client-0.6.jar
slf4j-api-1.4.0.jar

5. Start the ESB instance by running CARBON_HOME/bin/wso2server.sh or .bat file, now it will connect to the Qpid instance running successfully.

Configuring ESB instance which picks incoming messages from Qpid and forward them to the actual service

Perform all the steps from step 1-5 in the ESB in main setup where we call the MemberVerification service directly. This ESB has to configure with Qpid to pick messages from the queues and send the request to the actual
service and once the response comes back put the reponse in to the reply queue defined in server.properties file.

But in the server.properties file you do not need to add a replyQueue in the configuration and and server.properties file looks like this.

connectionfactory.qpidConnectionfactory=amqp://guest:guest@clientid/test?brokerlist='tcp://10.3.24.99:5672'
destination.directQueue=direct://amq.direct//ServiceName

Assume 10.3.24.99 is the IP address of the machine where you run the Qpid instance.


I will be posting on how to configure two proxy services in ESB's to perform the above mentioned tasks in near future.



2 comments :

Swaroop said...

Hi Lahiru

Integration of WSO2 3.0.1 and Qpid 0.10 does not work. Defect: http://goo.gl/gtv4W
Next, we are trying to integrate the exact versions specified. Qpid 0.6 is no longer available for download. It would be helpful if you can share Qpid 0.6 with us, incase you have a private copy.

My email address - swaroop (dot) rath (at) uk (dot) bp (dot) com
Please let me know your email address so that I can get directly in touch with you in case of problems.

We plan to adapt WSO2 and would also appreciate contact points (technical/manegerial'/sales) in the team for problems we might run into in future.

lahiru said...

Hi Swaroop,

These issues comes due to wrong packaging done in Qpid which doesn't cause any issue in Non-OSGi environment, but WSO2 ESB is running on OSGi environment so these packaging cause problems,you need to have a new set of merge jar/jars to fix this issue. We have not yet tested the stability with Qpid 0.10 release.

I prefer going forward with 0.6 or 0.8 release which works fine with WSO2 ESB.

I have informed our sales team, they will contact you soon.

Thanks
Lahiru