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 |
---|
...
- Download and install WSO2 ESB from http://wso2.com/products/enterprise-service-bus. For a list of prerequisites and step-by-step installation instructions, refer to Getting Started in the WSO2 ESB documentation.
- Start two Sample a sample Axis2 server instances in ports 9001 and 9002. For instructions, refer to the section instance on port 9000. For instructions, see ESB Samples Setup - Starting Sample Back-End Services in the WSO2 ESB documentation.
...
Start the ESB server and log into its management console UI (https:
//localhost:9443/carbon
). In the management console, navigate to the Main Menu, click Service Bus and then Source View menu and click Source View in the Service Bus section. Next, copy and paste the following configuration, which helps you explore the example scenario, to the source view.
Anchor | ||||
---|---|---|---|---|
|
...
- 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.