In this blog, we shall look into the splitter pattern provided in SAP Cloud Platform Integration. The use of a splitter is quite clear from its name – to break out a composite message into a series of individual messages, each containing data related to one item.
How is Splitter supported in Integration Flows?
In SAP Cloud Platform Integration, a splitter is available as a Message Routing flowstep. When you configure a splitter flowstep, it can appear confusing at first. Lots of options!
Nevertheless, let us try to understand Iterating and General Splitter first.
A very cool way to understand the workings of the splitter is by configuring a integration flow like below (idea courtesy: HCI development team).
In the Content Modifier step, I insert the following payload in the Body. It is group of orders:
Each order has details in the following format.
Now, let us see how the splitter works. In the first splitter, after the content modifier, we have configured a General splitter the following properties.
The exclusive gateway step routes the message according to the ordernumber.
Let us go to the second splitter that has been configured as a Iterating splitter with expression type as Token.
This is how the output of the second splitter looks like. Notice that the root tags of the incoming payload is not retained and further, it has been grouped as per the number provided.
Note: The Token splitter is mainly used for non-xml payload. I have just illustrated this example so that you can understand its working. Here “<item>” (including the angle brackets) form the “token”.
And if we configure the Iterating splitter with the expression type as XPath and the properties as below, we get the same output as the previous one. The only difference being there shall be the XML tag in the beginning of the output message <?xml version=”1.0″ encoding=”UTF-8″?>.
The forth splitter is also a General splitter. But, I recommend that you configure the same so that you can see the difference with the Iterating splitter against the same message. The difference lies in the enveloping signature of the XML. Compare this output with the previous one.
You use the splitter flow step in SAP Cloud Platform Integration to break down a composite message. For XML payloads, you would use the general and iterative-xpath splitters. Iterative-token type is used for non-xml payloads. The other variants – IDOC and PKCS are used in specific scenarios. I shall cover those in another blog.