Configuring WSO2 ESB 4.5.1 with WSO2 MB 2.0.1 For Message Stores

This guide is to configure WSO2 Message Broker 2.0.1 with WSO2 ESB 4.5.1 locally. WSO2 MB is configured to use inbuilt Cassandra Database in this example, and only one MB instance will be used (of course you can cluster it).

Configurations for Message Broker

1.       Unzip WSO2 MB 2.0.1 pack. You can download it form here
2.       We will start WSO2 MB with a port offset of 1. For that open /repository/conf/carbon.xml file and define offset.
           <!-- Ports offset. This entry will set the value of the ports defined below to
            the define value + Offset.
            e.g. Offset=2 and HTTPS port=9443 will set the effective HTTPS port to 9445

3.        To start it with one node, we will use internal Cassandra bundled with WSO2 MB. As we have   all port off-set by 1, we will have to point MB to correct Cassandra port. Go to /repository/conf/advanced/qpid-virtualhosts.xml and edit it to the correct port.
     <idGenerator>org.wso2.andes.server.cluster.coordination.TimeStampBasedMessageI     dGenerator</idGenerator>
            Note: if you are using an external Cassandra instance you can point MB to it editing the              connection string.
4.        Whenever subscriptions are made or removed for queues, info level logs are printed. But when using MB 2.0.1 with Message processors it is always peeking for messages triggering subscription logs.  To stop that edit file available at /repository/conf/ file with the following line
    #andes specific 

5.       Now navigate to /bin and run wso2server.bat file, and start WSO2 MB.

Configurations for WSO2 ESB

Unzip WSO2 ESB 4.5.1 pack. You can download it form here

1.       Unzip WSO2 ESB 4.5.1 pack. You can download it form here
2.       To setup backend (for demonstration of this example.)
                 2.1     Navigate to /samples/axis2Server/src/SimpleStockQuoteService and run ‘ant’ to build.
                 2.2     Come back to /samples/axis2Server folder and run axis2Server.bat file.
                 2.3      Point your browser to and verify that the service is running.
3.       Open JNDI.proerties file in /repository/conf folder and point to the MB broker being run. Also use ‘carbon’ as the virtualhost. Define a queue called ‘JMSMS’ there. No need of a topic here, so comment it out.
    # register some connection factories
    # connectionfactory.[jndiname] = [ConnectionURL]
    connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673'
    # register some queues in JNDI using the form
    # queue.[jndiName] = [physicalName]
4.       Start WSO2 ESB by running /bin/wso2Server.bat file.
5.       Define a message Store by copy-pasting following config to the source view (Alternatively you can use message-store UI).
     <messageStore class=""
         <parameter name="java.naming.factory.initial">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
         <parameter name="java.naming.provider.url">repository/conf/</parameter>
         <parameter name="store.jms.destination">JMSMS</parameter>
6.        Define an end-point to send the message. In this example we use above backend we just set-up.
      <endpoint name="SimpleStockQuoteService">
         <address uri=""/>

7.         Define a message forwarding processor as below (by copy-pasting or using the Management Console UI).
      <messageProcessor class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor"
         <parameter name="">4</parameter>
         <parameter name="interval">4000</parameter>

Proxy Service for WSO2 ESB to Test Setup

Now to test the scenario use a proxy service like below.
  <proxy name="InOnlyProxy"

         transports="https http"
           <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
           <property name="OUT_ONLY" value="true"/>
           <property name="target.endpoint" value="SimpleStockQuoteService"/>
           <log level="full"/>
           <store messageStore="JMSMS"/>

Note the highlighted parts, which are related.
Now whenever a message comes to this proxy service, it will be stored in JMS message store (which is in MB, JMSMS queue. If you disable message processor and send messages you will notice in MB management console message count of JMSMS queue being increased.)

This is “In Only” service invocation with Message Forwarding Processor. Similarly, following this article  you can implement the others. 

To Test 

With soap UI send the following soap message to the InOnlyProxy. 
<soapenv:Envelope xmlns:soapenv="" xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd">


Message will be logged at ESB console, SOAP UI will get 202 Accepted message, and at axis2Server console following will be logged. :: Generating quote for : IBM

Hasitha Hiranya


  1. Hi,

    I followed the steps but my esb starts at port 8243

    It throws error "Can not create the event broker "

    I had posted problem here also, and you might know it,

    please help me in this regard.

    Thanks and Regards,

  2. Hi,

    port 8243 is from axis2.xml in \repository\conf\axis2.

    do we have to change anything in event-broker.xml at \repository\conf

    My esb isnt running...

    Thanks and Regards.