Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
bhalchandraswcg
Contributor

Previous - Content-based Router | Index | Next - Dynamic Router


This week, we'll study a variation of Message Router pattern known as Message Filter.

When do I use this pattern?


This pattern applies when messages are sent to a receiver if the message satisfies a condition otherwise the message is discarded. For example, consider a scenario where products are sent to the planning system. However, the planning system only needs products that are supplied by the company itself (Exotic Liquids).

Note that this blog focuses on the Message Filter pattern (a Message Routing pattern) and not Content Filter pattern (a Message Transformation pattern). Think of it like:
Message Filter filters [out] message entirely as it is

Content Filter filters [out] content of the message

Message Filter in CPI


Like other Message Routing patterns, Message Filter is implemented using the Router component.

For the demonstration, I'll read a product from Northwind and log the product only if it is supplied by 'Exotic Liquids'. Here, logging represents sending the products to the planning system.

Integration Flow




Here, Router 'Supplier?' is used to send products supplied by 'Exotic Liquids' to Planning System (the Log step) and products supplied by Other suppliers are discarded (the Discard step).

Here's the configuration of the Routing Condition table:





















Order Route Name Condition Expression Default Route
1 Exotic Liquids /Products/Product/SupplierID = '1' No
2 Other Yes

Output


When the Integration flow is executed for Products supplied by 'Exotic Liquids', the products are logged:



When the integration flow is executed for Products supplied by Other suppliers, the products are discarded:


Conclusion


Message Filter is a type of Message Router that is used to send message to a receiver based on a condition. The messages that do not satisfy a condition are discarded.

Reference/Further Readings



Hope this helps,
Bala

Previous - Content-based Router | Index | Next - Dynamic Router


P.S.: Next week, we'll study Dynamic Router and I am excited to share a cool way of processing IDocs in SAP Cloud Platform Integration that promotes encapsulation, facilitates code maintenance, reduces code footprint, among other benefits.

Another P.S.: alexander.bundschuh has already blogged about Message Filter. He is using an example of filtering based on Product Category in CPI. Read Alex’s blog to learn about implementing Message Filter in Process Orchestration as well as in CPI.
Labels in this area