This section describes how WSO2 ESB can be configured as a RabbitMQ message consumer.
Following is a sample scenario that demonstrates how the ESB is configured to listen to a rabbitMQ queue, consume messages, and send the messages to a HTTP back-end service.
To create proxy services, sequences, endpoints, message stores and message processors in the ESB, you can either use the ESB Management Console or copy the XML configuration to the source view. To access the source view on the ESB Management Console, go to Manage -> Service Bus -> Source View.
- Configure the RabbitMQ AMQP transport. For information on how to configure the transport, see Configuring the RabbitMQ AMQP transport.
- Start the ESB server.
Configure the sample
Create a custom proxy service with the following configuration. For more information on creating proxy services, see Working with Proxy Services.
- WSO2 ESB comes with a default Axis2 server, which you can use as the back-end service for this sample. To start the Axis2 server, navigate to
<ESB_HOME>/samples/axis2server, and run
axis2Server.shon Linux or
- Deploy the SimpleStockQuoteService client by navigating to
<ESB_HOME>/samples/axis2Server/src/SimpleStockQuoteService, and running the ant command on the command prompt or shell script. This will build the sample and deploy the service for you. For more information on sample back-end services, see Deploying sample back-end services.
Now you have a running ESB instance with a custom proxy service and a back-end service deployed. Next, we will send a message to the back-end service through the ESB using a sample client.
Execute the sample client
Run the following client to publish a getquote request to the RabbitMQ server exchange that is running on port
Analyzing the output
The direct exchange is bound to the queue with route-key
queue that is consumed by the ESB RabbitMQ transport receiver. From there the message will be sent to the AMQPProxy and it will be forwarded to the given http url.
If you analyze the console running the sample Axis2 server, you will see the following message indicating that the server has accepted an order