The Scenario of Interest
1. Client submits an API request with a correlation id and a call back queue to RabbitMQ
2. ESB receives the request from RabbitMQ
3. ESB forwards the request to Endpoint
4. ESB receives the response from Endpoint
5. ESB if receives a response from Endpoint, publishes it at the call back queue specified in the request with the correlation id of the request
6. ESB if doesn't receive a response in timely manner posts an error in the Dead Letter MQ with the correlation id of the request
7. Client receives the response from the call back queue
8. Since request and response have the correlation id, client knows which response is for which request
* Configure the ESB to use rabbitmq transport as explained in https://docs.wso2.com/display/ESB481/RabbitMQ+AMQP+Transport
* Start axis2 server and deploy SimpleStockQuote Service as explained in https://docs.wso2.com/display/ESB481/Setting+Up+the+ESB+Samples
* Go to the management console of ESB and click on 'Source View'
* Copy paste the following synapse configuration into the 'Source View" and click update
* Now you have deployed a rabbitmq proxy service which will,
consume messages from a queue called "rpc-queue"
calling the back end simple stock quote service for the symbol found in that request message
receiving response from back end
setting the correlation id of the request to the response
publishes the response to the call back queue found in the request
if ESB is not getting any response from back end, it will publish an error message, with the correlation id of the request, to a queue called "dead-queue"
* Now run the following RPCClient.java
* Now login to the management console of the rabbitmq server (http://localhost:15672)
* You will see that there is message in your call back queue. This message is the response sent by the ESB.
* Now run the following RPCReceiver.java
* You will get the message in your console. This is the message RPCReceiver pulled from your call back queue. This will have the correlation id of the request too.
* Have a look at in rabbitmq management console, the previous message will not be there, as it is pulled by the RPCReceiver.
* Now shutdown axis2 server
* Run RPCClient.java
* Have a look at rabbitmq management console, you will find that there is a message in a queue called "dead-queue". Since the back end service is unavailable, ESB sends the response to dead queue with the correlation id of the request
I will explain this scenario in detail soon.
No comments:
Post a Comment