...
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:
Code Block |
---|
wso2esb-samples.bat -sn 0 |
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.
Deploying the Back-End Service
Executing the Sample
3. The synapse configuration in the ESB used for message mediation in this sample is provided in <ESB_HOME>/repository/samples
/synapse_sample_0.xml
as shown below:
Code Block | ||
---|---|---|
| ||
<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 can operate in the following modes for this example:
Smart Client mode
4. Deploy the back-end service 'SimpleStockQuoteService' and start the Axis2 server using the instructions given in section Starting Sample Back-End Services.
5. Now you have a running ESB instance and a back-end service deployed. In the nest section, we will send a message to the back-end service through the ESB using a sample client.
Executing the Sample
1. The sample client used here is 'Stock Quote Client' which can operate in several modes. 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 display an output on the Axis2 server's start-up console.
Smart Client Mode
Code Block | ||
---|---|---|
| ||
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ |
...