This section explains, through an example scenario, how the Detour EIP can be implemented using WSO2 ESB. The following topics are covered:
Table of Contents |
---|
...
- localEntry [line 2 in ESB config] - Specifies a local entry containing the XML schema to use for validation.
- sequence [line 32 31 in ESB config] - The main sequence for the ESB, which is the default sequence.
- filter [line 34 3 in ESB config] - The filter mediator that is used to provide content based routing. In this case, the SOAP Header field
To
is matched against a regular expression that checks to see whether theTo
field containsStockQuote
. - validate [line 35 34 in ESB config] - Performs validation on the SOAP body using the XML Schema defined in the
localEntry
(line 2 in ESB config). - on-fail [line 37 36 in ESB config] - If the validation fails, the on-fail element provides a detour, which can be used to channel the message through a different route and ultimately passed on to the intended service. In the example scenario, a fault is produced and the fault is sent back to the requesting client.
- send [line 45 44 in ESB config] - the send mediator is used to send the message to the intended receiver - however if the
makeFault
inside the on-fail element (line 37 in ESB config) is executed before this mediator is reached, then the fault is returned to the requesting client.