Versions Compared

Key

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

...

Refer to Prerequisites section in ESB Samples Setup page.

Building the Sample

To build and run samples, 1. Start the ESB should be started with a sample configuration by executing wso2esb-samples.bat (for Windows) or wso2esb-samples.sh (for Linux) script found in <ESB_HOME>/bin directory. The sample configurations for ESB can be found in <ESB_HOME>/repository/samples directory.

You can switch from the default INFO log messages to DEBUG log messages by changing the line 'log4j.category.org.apache.synapse=INFO' to 'log4j.category.org.apache.synapse=DEBUG' in the <ESB_HOME>/repository/conf/log4j.properties file.

Starting ESB with Sample Configuration

1. Since this is sample 0, execute the following command to start the Synapse configuration numbered 0. It will start an instance of the ESB in the configuration used for this sample.

On text Linux console:

Code Block
wso2esb-samples.sh -sn 0

On Windows command prompt:

...

0 configuration using the instructions given in Starting Sample ESB Configurations.

2. A message should appear on in the command or text Linux console stating the server started successfully.

...

3. Deploy the back-end service 'SimpleStockQuoteService' and start the Axis2 server using the instructions given in section Starting Sample Back-End

...

 Services.

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

Executing the Sample

 1. The synapse configuration in the ESB related to this sample is <ESB_HOME>/repository/samples/synapse_sample_0.xml as shown below:

Code Block
languagehtml/xml
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <sequence name="main">
      <in>
         <!-- log all attributes of messages passing through -->
         <log level="full"/>
         <!-- Send the message to implicit destination -->
         <send/>
      </in>
      <out>
         <!-- log all attributes of messages passing through -->
         <log level="full"/>
         <!-- send the message back to the client -->
         <send/>
      </out>
   </sequence>
</definitions>

 

The Stock quote client 2. The sample client is used here is 'Stock Quote Client' which can operate in the following modes for this example:. For instructions on this sample client and its operation modes, refer to Stock Quote Client. Run each of the following ant command from <ESB_HOME>/samples/axis2Client directory to trigger a sample message to the back-end service. If the message is mediated successfully, it should output on the Axis2 server's startup console.

Smart Client

...

Mode
Code Block
languagebash
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/

...