Enterprise Integration Patterns at SAP Cloud Integration: Content Filter
In the current blog I would like to describe how to model the Content Filter pattern on both SAP Process Orchestration and SAP Cloud Integration. You use a Content Filter to remove data from a message that you do not need in your application system. You only keep the important information.
If you like to find out more about the motivation and use cases for the Enterprise Integration Pattern blog series, start with the Enterprise Integration Patterns at SAP Cloud Integration: Scatter-Gather blog. Also, check out the Integration Flow Design Guidelines for SAP Cloud Integration blog referring to integration flow design guidelines and patterns for SAP Cloud Integration that SAP has recently published on the SAP Help Portal.
Content Filter on SAP Process Orchestration
In our example, a purchase order contains multiple items of different product categories. The Content Filter pattern is implemented using a message mapping. In the message mapping, we remove all items within the purchase order which are not intended for a particular receiver, so we only keep those items of a specific product category, here Notebooks.
As you can see, all the header fields are mapped one by one. For the Item node, we check if the Category equals Notebooks. If so, we create the node, otherwise the item is discarded. All fields below the Item node are mapped one by one.
You can find another example of the Content Filter in the Stateless Enterprise Integration Patterns on SAP Process Orchestration paper. Here, we combined the Content Filter with the Splitter pattern. By the way, the Splitter pattern is still on my backlog.
Content Filter on SAP Cloud Integration
On SAP Cloud Integration, we do have two options: either use the dedicated Filter flow step or re-use the message mapping from the example above. Both options are described in the SAP Help Portal. For latter option, see how message mappings can be imported from an Enterprise Service Repository of SAP Process Orchestration here. Let’s focus here on the first option.
In the integration flow model below you can see that we use a Filter flow step where we maintain the xpath expression accordingly. Here, we keep all items with category Software. Value type needs to be Nodelist since the xpath expression may apply to multiple items. The filter removes the purchase order header. So, we need to save this part in an exchange property using a content modifier, and in another content modifier we construct the message based on the item list and the stored header fields.
On the SAP API Business Hub, you find the sample integration flow within the Integration Flow Design Guidelines – Enterprise Integration Patterns package. You can test the pattern on your SAP Cloud Integration tenant. It also runs on the cloud integration runtime of your SAP Process Orchestration 7.5 system.
Beside the Content Filter, we have published a couple of more patterns. Here’s the complete list of patterns: