All docs This doc

Versions Compared

Key

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

Objective: Demonstrate message

Table of Contents

Introduction

This sample demonstrates message routing to a set of dynamic endpoints.

Prerequisites

For a list of prerequisites, see Prerequisites to Start the ESB with Samples.

Building the

...

sample

The XML configuration for this sample is as follows: 

Code Block
languagehtml/xml
linenumberstrue
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <sequence name="errorHandler">
      <makefault response="true">
         <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver" />
         <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER." />
      </makefault>
      <send />
   </sequence>
   <sequence name="fault">
      <log level="full">
         <property name="MESSAGE" value="Executing default &quot;fault&quot; sequence" />
         <property name="ERROR_CODE" expression="get-property('ERROR_CODE')" />
         <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')" />
      </log>
      <drop />
   </sequence>
   <sequence name="main" onError="errorHandler">
      <in>
         <property name="EP_LIST" value="http://localhost:9001/services/SimpleStockQuoteService,http://localhost:9002/services/SimpleStockQuoteService,http://localhost:9003/services/SimpleStockQuoteService"/>	
         <property name="OUT_ONLY" value="true" />
         <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" />
         <send>
            <endpoint>
               <recipientlist>
                  <endpoints value="{get-property('EP_LIST')}" max-cache="20" />
               </recipientlist>
            </endpoint>
         </send>
         <drop/>
      </in>
   </sequence>
</definitions>
Info

You are required to replace ESB_Home with the actual folder name of the ESB home.

 

Deploy the SimpleStockQuoteService and start three instances of sample Axis2 server as mentioned in sample 52 Sessionless Load Balancing Between 3 Endpoints.

...

This configuration file  synapse_sample_61.xml is available in the <ESB_HOME>/repository/samples directory.

To build the sample

  1. Start the ESB with the sample 61 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.

    The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."

  2. Start three instances of the sample Axis2 server on HTTP ports 9001, 9002 and 9003 and give unique names to each server. For instructions on starting the Axis2 server, see  Starting the Axis2 server .

  3. Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.

Executing the sample

The sample client used here is the Stock Quote Client, which can operate in several modes. For further details on this sample client and its operation modes, see Stock Quote Client.

To execute the sample client

  • Run the following command from the <ESB_HOME>/samples/axis2Client directory to send an out-only message

...

  • :

    Code Block
    languagebash
    ant stockquote -Dmode=placeorder -Dtrpurl=http://localhost:8280/

...