Configuring WSO2 ESB V4.0.0 with Qpid

  • By Vijayaratha Vijayasingam
  • |
  • 31 Aug, 2011

In this post, we will refer WSO2 ESB V4.0.0 as ESB and the ESB installation directory as ESB_HOME.


Applies To :

WSO2 ESB 4.0.0

1. Enabling 'JMS' transport in ESB

First, we need to download the ESB distribution. You can download WSO2 ESB 4.0.0 here. Extract the downloaded .zip into a directory. Go to ESB_HOME/repository/conf folder, where in the axis2 configuration file, you need to activate the 'JMS' transport sender and receiver in order to send and receive messages with Qpid as underlying JMS provider.

By default,in this(axis2.xml) file JMS transport is commented out. Do the changes as below;

1) At Transport In section;

 <!--Transport Ins --> 
 <!--Uncomment this and configure as appropriate for JMS transport support with Apache Qpid --> 
     <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">         
         <parameter name="myTopicConnectionFactory" locked="false"> 
             <parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.
             <parameter name="java.naming.provider.url" locked="false">repository/conf/</parameter> 
             <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter> 
             <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> 
         <parameter name="myQueueConnectionFactory" locked="false"> 
             <parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.
             <parameter name="java.naming.provider.url" locked="false">repository/conf/</parameter> 
             <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter> 
             <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> 

At Transport Out section;

 <!-- uncomment this and configure to use connection pools for sending messages--> 
     <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> 

In the above configuration, if you notice that, we point “ file” as the value for “java.naming.provider.url” .

2) Add following lines to create connection factory, queue , topic etc.. at file(ESB_HOME/repository/conf/;

      connectionfactory.TopicConnectionFactory = amqp://admin:[email protected]/carbon?brokerlist='tcp://localhost:5672' 
      connectionfactory.QueueConnectionFactory = amqp://admin:[email protected]/carbon?brokerlist='tcp://localhost:5672' 
      queue.MyQueue = example.MyQueue 

Now, if you restart the ESB server, you will be able to send and receive messages from/to an JMS endpoint. You can find more detail documentation on JMS transport here[1].

2. Configuring Qpid as the Message-store

Message-store functionality is available in ESB 4.0.0 version to provide advanced enterprise messaging capability. There are two kind of implementations available;

  • In-memory implementation
  • Persistent JMS implementation

With in-memory implementation, we can store and froward messages efficiently and it is the fastest implementation. But, when we restart the server, messages which are stored in the queue before server goes down, will be lost. Which can be considered as a disadvantage in this kind of implementation.

To make queue(store) as durable, we can use JMS persistent implementation, which is written in a way to support common JMS providers, which follow JMS 1.1 spec.

Message Store does not need JMS transport sender/receiver enabled. But if you use "Send " mediator, you should enable JMS transport.

2.1 Sample Message Store Configuration for Qpid

Your Message Store configuration should have minimum three parameters;

      <messageStore xmlns="" class="
       JMSMessageStore"  name="testMsgStore">
          <parameter name="java.naming.factory.initial">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter> 
          <parameter name="java.naming.provider.url">repository/conf/</parameter> 
          <parameter name="store.jms.destination">MyQueue</parameter> 

The above configuration makes you to create a JMS based message store with Qpid, but the queue is not durable.

To make durable queue with Qpid, provide the value for “store.jms.destination” as follows;

 MyQueue;{create:always, node:{durable: True}}

Message Store parameter would be like;

 <parameter name="store.jms.destination">MyQueue;{create:always, node:{durable: True}}</parameter>

You can check whether the queue is durable or not via the jconsole.

There is a final configuration user should check.

In the ESB_HOME\repository\conf\advanced\qpid-virtualhosts.xml file, the 'carbon' virtual host points to "derby store"


So your connection factory url (which is provided via file)also should be like;

connectionfactory.QueueConnectionFactory = amqp://admin:[email protected]/carbon?brokerlist='tcp://localhost:5672' 

If you do all the above configurations, you will be able to connect to a durable Qpid queue..

3. Sample proxy configuration

This sample configuration shows, how an user can make Qpid as his JMS persistent Message store.

<proxy xmlns="" name="testJMSProxy" transports="https http" startOnLoad="true" trace="disable">
            <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
            <property name="target.endpoint" value="jmsEP" scope="default"/>
            <store messageStore="testMsgStore"/>
<messageStore xmlns="" class=""
name="testMsgStore"> <parameter name="java.naming.factory.initial">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter> <parameter name="java.naming.provider.url">repository/conf/</parameter> <parameter name="store.jms.destination">MyQueue;{create:always, node:{durable: True}}</parameter> </messageStore> <messageProcessor xmlns="" name="testMsgProcessor" messageStore="testMsgStore"
class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" /> <endpoint xmlns="" name="jmsEP"> <address uri="https://localhost:9000/services/SimpleStockQuoteService"/> </endpoint>


Vijayaratha Vijayasingam, Software Engineer, WSO2 Inc





About Author

  • Vijayaratha Vijayasingam
  • wso2