This documentation is for WSO2 Enterprise Service Bus version 4.9.0 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

Introduction

This sample demonstrates dual channel messaging through synapse.

Prerequisites

For a list of prerequisites, see Prerequisites to Start the ESB Samples.

Building the sample

  1. Start the ESB with the sample 0 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.

    The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."

  2. Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.

  3. Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.

    Now you have a running ESB instance and a back-end service deployed. In the next section, we will send a message to the back-end service through the ESB using a sample client.

Executing the sample

This example invokes the getQuote operation of the SimpleStockQuoteService using the custom client. The custom client uses the Axis2 ServiceClient API with useSeparateListener set to true, so that the response comes through a different channel than the one that is used to send the request to a callback defined in the client.

The sample client used here is the Stock Quote Client, which can operate in several modes. For more information on this sample client and its operation modes, see Stock Quote Client.

To execute the sample client

  • Run the following command from the <ESB_HOME>/samples/axis2Client directory.

    ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=dualquote

Analyzing the output

When you execute the client, you will see the dual channel invocation through Synapse into the sample Axis2 server instance, which reports the response back to the client over a different channel.

Response received to the callback
    Standard dual channel :: Stock price = $57.16686934968289

If you send your client request through TCPmon, you will see that Synapse replies to the client with a HTTP 202 acknowledgment when you send the request. The communication between Synapse and the server happens on a single channel. You will get the response back from Synapse to the client's callback through a different channel, which cannot be observed through TCPmon.

Also note the wsa:Reply-To header similar to http://localhost:8200/axis2/services/anonService2. This implies that the reply is in a different channel listening on port 8200.

It is required to engage addressing when using the dual channel invocation since the  wsa:Reply-To header is required.

  • No labels