Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This example demonstrates how the ESB uses messaging to invoke the functionality provided by an application. A command message can be in any form, including a JMS serialized object or a text message in the form of an XML or SOAP request. In this example, the ESB will pass the message as a document to a sample Axis2 server and invoke the operation directly using the Callout mediator.

The following diagram below depicts how to simulate the example scenario this example can be simulated using the ESB.:

Figure 2: Example scenario of the Command Message EIP

...

The configuration elements

Let's investigate the elements of the configuration in detailThe elements used in the above ESB configuration are explained below.

  • <callout> - The callout mediator specifies a particular method to invoke in the back-end service. This invocation is blocking.  
  • <source> - The source specifies the payload for the method invocation using xPath expressions. 
  • <target> - The target specifies the location where the response should be concatenated.

...

  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.

    Code Block
    ant stockquote -Dtrpurl=http://localhost:8280/services/command-message-proxy

Analyzing the output

The client receives the stock quote as the response. 
Stock Quote Client response: 

Standard :: Stock price = $85.09378162206208

Axis2 server response: 

...


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: 


Code Block
samples.services.SimpleStockQuoteService :: 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:


Code Block
Standard :: Stock price = $85.09378162206208