...
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?>
<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> |
...
Send a request using the Stock Quote client to WSO2 ESB in the following manner. For information about the Stock Quote client, refer to section Sample Clients in the WSO2 ESB documentation.
ant
...
stockquote
...
-Daddurl=http://localhost:9000/services/SimpleStockQuoteService
...
-Dtrpurl=http://localhost:8280
Note that the message mediates though main, seq1 and sendSeq before reaching the endpoint. Each sequence adds a property to the message, and the final Log mediator at sendSeq puts out those properties as follows:
INFO
...
-
...
LogMediator
...
mainSeq
...
=
...
**
...
At
...
Main
...
Sequence**,
...
seq1
...
=
...
***
...
At
...
Sequence
...
1
...
***,
...
sendSeq
...
=
...
***
...
At
...
Sequence
...
1
...
***
Similarly, you can add required entries to a message to track and display its mediation history.
...