How to integrate WSO2 ESB and Rabbitmq using AMQP transport – Part 1

Introduction

Recently I was working on an integration project where one of the main requirements was guarantee the delivery of the messages, no one message can be lost. For guarantee this requirement, you should think about integrate a Message Broker with persistence in your solution. In the project we were using WSO2 ESB and other WSO2 products, so the first choice was the use of WSO2 Message Broker. Although the integration between WSO2 ESB and WSO2 Message Broker is very handy, this option was discarded due to the high requirements needed for WSO2 Message Broker (9 JVM at least for ensure reliability). In my opinion, WSO2 Message Broker is a good choice if you need to process huge volumes of data, suits perfectly on big data projects, but that was not our case.

Finally the client choice was RabbitMQ, that suits perfectly with the business requirements of the project, but as we will see later, the integration with WSO2 ESB is not trivial. I’ve split up this experience in four posts:

  • How to integrate WSO2 ESB and Rabbitmq using AMQP transport (this post).
  • Get the AMQP transport library source code and patch it for build and publish messages from WSO2 ESB.
  • Extending AMQP transport library for implement Message Routing Pattern & Custom Messaging Channel Patterns.
  • Using Message Store / Message Processor to integrate WSO2 ESB with a Message Broker.

 

RabbitMQ installation

The installation of RabbitMQ is well detailed in his web, just follow the steps defined in the link for Windows Installation. I should like to stress that RabbitMQ uses Erlang as engine, so it’s necessary his installation.

Also I recommend the installation of the Management Plugin for get a user-friendly web management console.

rabbitmq-default-values

 

Integrate WSO2 ESB and RabbitMQ using AMQP transport

There are several ways to integrate WSO2 ESB and RabbitMQ, for now we focus on integrate WSO2 ESB and RabbitMQ using AMQP transport. WSO2 provides a good page for do this integration:

https://docs.wso2.com/display/ESB481/RabbitMQ+AMQP+Transport#RabbitMQAMQPTransport-InstallingtheRabbitMQAMQPTransport.

Unfortunately the installation section doesn’t work for me with WSO2 ESB 4.8.1 and RabbitMQ 3.3.5. The steps followed for achieve the integration are detailed below:

      1. Download and unzip the p2-repo.zip.
      2. Stop the ESB.
      3. Copy the jars existing in plugins folder (axis2-transport-rabbitmq-amqp_1.1.0.wso2v9.jar and amqp-client_3.3.4.wso2v1.jar) into {ESB_HOME}/repository/components/lib.
      4. Add the following RabbitMQ transport listener into {ESB_HOME}/repository/conf/axis2/axis2.xml, replacing the values with your host, port, username, and password to connect to the AMQP broker.
        <transportReceiver name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListener">
           <parameter name="AMQPConnectionFactory" locked="false">
              <parameter name="rabbitmq.server.host.name" locked="false">127.0.0.1</parameter>
              <parameter name="rabbitmq.server.port" locked="false">5672</parameter>
              <parameter name="rabbitmq.server.user.name" locked="false">guest</parameter>
              <parameter name="rabbitmq.server.password" locked="false">guest</parameter>
           </parameter>
        </transportReceiver>
        
      5. Add the following RabbitMQ transport sender into {ESB_HOME}/repository/conf/axis2/axis2.xml, which will be used for sending AMQP messages to a queue.
        <transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender"/>
        
      6. Start the ESB.

We are ready now to implement the sample Receive and Publish proxy service in ESB, as detailed here.

This sample proxy service is listening a queue, and once a message is published into the queue (using a Java Client), the message is immediatly consumed by the proxy. Finally the proxy publish in a different queue the message consumed.

rabbitmq

I want to emphasise that, in this sample, we are not building in the ESB the message that is published into the queue, the message is built using a Java Client. The current version of the AMQP transport library, axis2-transport-rabbitmq-amqp_1.1.0.wso2v9.jar, has some reported bugs (e.g. CARBON-14522 and CARBON-14981), and for now is not posible do that. In the next post I will explain how to get the source code of the AMQP transport library and fix these bugs. This way we will can implement a proxy service for build and publish a message into RabbitMQ.

Finally, to gain a better understanding of how RabbitMQ works , you can get a lot of documentation on his web page. In particular, I recommend the following links:

 

Conclusions

In this post we have seen how to integrate WSO2 ESB and RabbitMQ using AMQP transport. From my point of view, do the integration at transport level is not the best option, we are high coupling both products. In the next posts, we will see how to extend this integration for solve some reported bugs and for implement Message Routing Pattern & Custom Messaging Channel Patterns (Dead Letter & Retry Queue Pattern), and in the last post of the series, I will explain how should be the integration for ensure low coupling using Message Store and Message Processor.

Un comentario en “How to integrate WSO2 ESB and Rabbitmq using AMQP transport – Part 1

  1. Pingback: Evaluación del nivel y madurez de integración de Message Brokers opensource con WSO2 ESB | Holistic Security and Technology

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s