This documentation is for WSO2 ESB version 4.5.0. View documentation for the latest release.

Sample 13: Dual Channel Invocation through Synapse

Objective: To demonstrate dual channel messaging through synapse.

Prerequisites
  • Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps above).
  • Start the Synapse configuration numbered 0: wso2esb-samples.sh -sn 0

This example invokes the same getQuote operation on the SimpleStockQuoteService using the custom client, which uses the Axis2 ServiceClient API with useSeparateListener set to true so that the response is coming through a different channel than the one which is used to send the request to a callback defined in the client. To test this, use ant -Dmode=dualquote... and you will notice the dual channel invocation through Synapse into the sample Axis2 server instance, which reports the response back to the client over a different channel.

ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=dualquote
Response received to the callback
    Standard dual channel :: Stock price = $57.16686934968289

If you send your client request through TCPmon, you will notice that Synapse replies to the client with a HTTP 202 acknowledgment when you send the request and the communication between synapse and the server happens on a single channel and then you get the response back from synapse to the clients callback in a different channel (which cannot be observed through TCPmon).

Also you could see the wsa:Reply-To header being something like http://localhost:8200/axis2/services/anonService2 which implies that the reply is being on a different channel listening on the port 8200.

Info:
It is required to engage addressing, when using the dual channel invocation, because it requires the wsa:Reply-To header.