...
Code Block | ||||
---|---|---|---|---|
| ||||
<definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="sendSeq">
<property name="sendSeq"
value="*** At Sending Sequence ***"
scope="default"
type="STRING"/>
<log level="custom">
<property name="mainSeq" expression="get-property('mainSeq')"/>
<property name="seq1" expression="get-property('seq1')"/>
<property name="sendSeq" expression="get-property('seq1')"/>
</log>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
</sequence>
<sequence name="seq1">
<property name="seq1"
value="*** At Sequence 1 ***"
scope="default"
type="STRING"/>
<sequence key="sendSeq"/>
</sequence>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' 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">
<in>
<filter xmlns:ns="http://org.apache.synapse/xsd"
source="get-property('To')"
regex="http://localhost:9000.*">
<then>
<property name="mainSeq" value="** At Main Sequence**"/>
<sequence key="seq1"/>
</then>
<else/>
</filter>
</in>
<out>
<send/>
</out>
<description>The main sequence for the message mediation</description>
</sequence>
</definitions> |
...
Let's investigate the elements of the ESB configuration in detail. The line numbers below refer to the ESB configuration shown abovestep3.
- Sequence [line 21 19 in ESB config] - The sequence with key
seq1
defines a Message Context property calledseq1
and calls the sequencesendSeq
. - Sequence [line 38 36 in ESB config] - This is the main sequence that is invoked when the ESB receives a request. The main sequence filters the messages (line 40 38 in ESB config) to determine whether the request is going to an endpoint that begins with
http://localhost:9000
. If so, a Message Context property calledmainSeq
is defined, and the sequenceseq1
is invoked. - Sequence [line 4 2 in ESB config] - The sequence with key
send_seq
defines a Message Context property calledsendSeq
. It then logs the properties by calling theget-property
XPath function for the properties set in all the sequences, namelymainSeq
,seq1
, andsendSeq
. After logging this information, the Send mediator is called to forward the message to the endpoint.