...
The Point-to-Point Channel EIP pattern allows ensures that only a single receiver to consume consumes a sent message (when there are multiple receivers waiting to consume itthe message). For more information, go to see Point to Point Channel.
Figure 1: Point-to-Point Channel EIP
Example scenario
The example scenario is uses an inventory for of 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 example scenario this example is simulated using the ESB.
Figure 2: Example scenario of the Point-to-Point Channel EIP
...
- Open a new terminal, and navigate to the
<ESB_HOME>/samples/axis2Client/
directory. The Stock Quote client application is stored in this directory. Execute the following command to send the request to the ESB.
Code Block ant stockquote -Dtrpurl=http://localhost:8280/services/point-to-point-proxy -Dsymbol=foo
The structure of the request should be as follows:
Code Block <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
Note that, out of all three instances of the Stock Quote
service (Axis2 server), only one server acquires the sent request at a given time.
Stock client response:
Standard :: Stock price = $81.06211284751495
samples.services.SimpleStockQuoteService :: Generating quote for : foo
Info |
---|
If you try sending multiple requests, you will notice in the Console logs of each of the Axis2 server instances that the three of them are receiving the message one after another (i.e., in Round Robin pattern). |