Enterprise Integration Patterns

Point-to-Point Channel

The Point-to-Point Channel EIP pattern allows only a single receiver to consume a sent message when there are multiple receivers waiting to consume it.

For more information, go to Point to Point Channel

The following sections explain how you can implement a sample scenario of this EIP using the ESB profile of WSO2 EI. 

Sample scenario

The sample scenario is an inventory for stocks. It illustrates how a stock quote is generated, which only a single consumer receives at a given time. The diagram below depicts how to simulate the sample scenario using the ESB profile.

 The Synapse configurations of the artifacts

When you unzip the ZIP file you download below in Step 6 when simulating the sample scenario, you can find the below configurations in the <UNZIPPED_FILE>/src/main/synapse-config directory. For more information about these artifacts, go to WSO2 EI Documentation.

Simulating the sample scenario 

Follow the below instructions to simulate this sample scenario.

The structure of the request should be as follows:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd">
   <soapenv:Header />
   <soapenv:Body>
        <ser:getQuote>        
         <ser:request>
             <ser:symbol>foo</ser:symbol>
         </ser:request>      
      </ser:getQuote>
   </soapenv:Body>
</soapenv:Envelope>

Analyzing the output

Out of the three instances of the Stock Quote service (Axis2 server), only one server acquires the sent request at a given time. When you execute the request, the ESB profile first receives the message and then routes it to the back-end service (StockQuoteService). The following output will be printed on the Axis2 Server Console: 

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 Console:

If you try sending multiple requests, the Console logs of each of the Axis2 server instances will display that the three of them are receiving the message one after the other (i.e., in Round Robin pattern).