Enterprise Integration Patterns

Pipes and Filters

The Pipes and Filters EIP breaks down a large task into smaller subsets of independent steps that are chained together. This is useful when a sequence of processing steps are required to perform a single event in an integration scenario. The main use case of this EIP is to maintain independence and flexibility between each processing step.

For more information, go to Pipes and Filters.

The following sections explain how you can implement a sample scenario of this EIP using the ESB profile of WSO2 EI. 

Sample scenario

The example scenario depicts how a stock quote request is sent from a client to a service (Stock Quote Service). The request is first received by the ESB profile, which transmits the request through the following filters:

  • Check Username filter: to verify the username.
  • Check User ID filter: to verify the user ID.

Filter Mediators are used in the ESB, to verify the validity of the message (checking the username and user ID).

If the message meets the criteria of the first filter, it will be passed to the second filter. Once the request successfully passes through the second filter (i.e., the filtering criteria is fulfilled), the ESB sends the stock quote request to the back-end service (Stock Quote Service) for processing.

 The Synapse configurations of the artifacts

When you unzip the ZIP file you download below in Step 6 when simulating the sample scenario, you can find the below configurations in the <UNZIPPED_FILE>/src/main/synapse-config directory. For more information about these artifacts, go to WSO2 EI Documentation.

Setting up the sample scenario

Follow the below instructions to simulate this sample scenario.

Executing the sample

Send the following request to the ESB Profile using SOAP UI (or any other SOAP client).

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.samples" 

Analysing the output

When you send the request, the ESB Profile receives the message first and then routes it to the back-end service (Stock Quote Service). The following output will be printed on the Axis2 server's Console, confirming that the request is successfully received by the back-end service.

You can view the response in the SOAP UI as follows. 

If you send another request by changing the name or ID, the request fails as shown below.