This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit

Message Channels

This section explains, through an example scenario, how the Message Channels EIP can be implemented using the WSO2 ESB. The following topics are covered:

Introduction to Message Channels

Message Channels facilitate communication between applications. A sender adds a message to a particular channel. A receiver can then read this message. Channels allow the sender and receiver to synchronize. For more information, go to Message Channel

Figure 1: Message Channel EIP

Example scenario

The following diagram depicts an example scenario that is carried out using the ESB. In this example, a stock quote is requested by a client application from a service. As shown below, the client application sends the request to the receiver through a message channel (defined in the ESB). The message channel retrieves the message content from the sender, and it allows the receiver to read the content through the channel.

Figure 2: Sample scenario of the Message Channel EIP

Before digging into implementation details, let's look at how the core components in this example scenario map to the Message Channel EIP:

Message Channel EIP (Figure 1)Message Channel sample Scenario (Figure 2)

Sender Application

Stock Quote Client
Message SystemWSO2 ESB

Receiver Application 

Stock Quote Server 

The ESB configuration

Given below is the ESB configuration for simulating the example scenario explained above.

<definitions xmlns="">
   <proxy name="message-channel-proxy" startOnLoad="true" transports="http https">
            <sequence key="message-channel-sequence" />
            <log level="custom">
               <property name="sending response to" value="client" />
            <respond />
         <faultSequence />
   <sequence name="message-channel-sequence">
      <log level="custom">
         <property name="sending request to" value="axis2 server" />
            <address uri="http://localhost:9000/services/SimpleStockQuoteService" />

The configuration elements

The elements used in the above ESB configuration are explained below.

  • <proxy> - This is the proxy service that should be invoked to execute the configuration.
  • <inSequence> - A message is first received by the proxy service, and then directed to this sequence.
  • <outSequence> - This sequence is triggered after the execution of the <inSequence>.
  • <sequence> - This is an external sequence, which is invoked by the proxy.
  • <send> - This is the Send mediator that routes the message to the endpoint indicated by the address URI.

Simulating the example scenario

Now, let's try out the example scenario explained above.

Setting up the environment

You need to set up the ESB, and the back-end service:

  1. Download the file, which includes the ESB configuration described above. 
  2. See Setting up the Environment for instructions on setting up the ESB and the back-end service.

    When you set up the environment, note that you only need to start one instance of the back-end service (Stock Quote Service) to simulate this example.

Executing the sample

Let's send a request to the ESB using the Stock Quote Client application. Find out more about the Stock Quote Client from the ESB documentation.

  1. Open a new terminal, and navigate to the <ESB_HOME>/samples/axis2Client/ directory. The Stock Quote client application is stored in this directory.
  2. Execute the following command to send the request to the ESB.

    ant stockquote -Dtrpurl=http://localhost:8280/services/message-channel-proxy

Analyzing the output

When you execute the command above, the ESB first receives the message and then routes it to the back-end service (StockQuoteService). The following output will be printed on the Axis2 server's console: :: Generating quote for : IBM

The generated stock quote will then be sent to the client application (Stock Quote Client). The following output will be printed on the client application's console:

Standard :: Stock price = $72.42070059233666