Tuesday, August 13, 2013

How to connect multiple ActiveMQ Brokers to WSO2 Enterprice Service Bus

Common use case scenario is work WSO2 ESB with one broker service. But when it goes to production deployment it may need to have more than one broker service due to maintain high availability in the production system. WSO2 ESB facilitate to connect more than one ActiveMQ brokers to serve above requirement.

Common use-case :
 Multiple  Broker use-case




Following are the steps need to be taken in to configure WSO2 ESB to work with the multiple ActiveMQ brokers.

1. Configure one ActiveMQ broker with ESB instance like common use-case. Please follow my previous blog post to do that.
2. Now start another ActiveMQ instance.
3. Assume first ActiveMQ instance port is 61616, second instance port is 61617.
4. Open axis2.xml located in ESB_HOME/repository/conf/axis2/ location
5. Now you already have one JMS receiver like follows.



    6. Add another new transport receiver as follows. make sure to change "transportReceiver name". this will be second transport receiver.




    7. Now start ESB server. ESB console will prints below messages once ESB server successfully connected to the both ActiveMQ brokers.


    INFO - PassThroughHttpListener Initializing Pass-through HTTP/S Listener...
    INFO - JMSConnectionFactory JMS ConnectionFactory : myTopicConnectionFactory initialized
    INFO - JMSConnectionFactory JMS ConnectionFactory : myQueueConnectionFactory initialized
    INFO - JMSConnectionFactory JMS ConnectionFactory : default initialized
    INFO - JMSListener JMS Transport Receiver/Listener initialized...
    INFO - JMSConnectionFactory JMS ConnectionFactory : myTopicConnectionFactory initialized
    INFO - JMSConnectionFactory JMS ConnectionFactory : myQueueConnectionFactory initialized
    INFO - JMSConnectionFactory JMS ConnectionFactory : default initialized
    INFO - JMSListener JMS Transport Receiver/Listener initialized...


    8. Now you can create sample proxy service by adding both JMS listners. It will listen to both ActiveMQ broker queues.