crashcourse-platform-create-splitting-messages
Version 1.1 by marijn on 2022/05/10 11:22
Splitting messages
Sometimes you receive or need to retrieve a batch file of data containing a large number of iterations on the same object (i.e Project, Employee, Order, Invoice, etc.) that you want or need to process individually from one another. To do so you can use the splitter functionality of eMagiz to split the incoming messages into multiple messages.In this microlearning, we will educate you on how you can split messages with the help of eMagiz tooling.Should you have any questions, please contact academy@emagiz.com.- Last update: February 8th, 2021
- Required reading time: 7 minutes
1. Prerequisites
- Basic knowledge of the eMagiz platform
2. Key concepts
This microlearning focuses on splitting messages.With splitting messages we mean: Cutting up the input messages in multiple output messages with the same format3. Splitting messages
Sometimes you receive or need to retrieve a batch file of data containing a large number of iterations on the same object (i.e Project, Employee, Order, Invoice, etc.) that you want or need to process individually from one another. To do so you can use the splitter functionality of eMagiz to split the incoming messages into multiple messages.There are two split options available on flow level in eMagiz:- Standard splitter
- Xpath splitter

3.1 Basic
In this use case, we want to split our list of Projects into single Project messages that will validate against our system message.

- The structure of the input message
- Whether the input messages has a namespace
- Always start at the root of the input message when writing an XPath outside of the transformation

- The absence of a namespace declaration within the example message
- No namespace prefixes throughout the example message


3.2 Variations
The above XPath expression is not the only expression that will yield a correct result. In case you don't want to start your XPath expression at the root level but somewhere in the middle of your input message you can use two forward backslashes (i.e. ) to determine that you want to start at a certain element in the input message. In this example, we also could have written the Xpath as Project which yields the same result. Especially in cases where there is a nested structure of multiple lists, it could be advantageous to start at one of those lists instead of starting at the root level to reduce the complexity of your XPath.In cases where you don't know whether or not a namespace will be used in the input message or you don't want to specify namespace and namespace prefix, you can utilize the wildcard option in eMagiz. This wildcard option states that all namespaces and namespace prefixes are valid when trying to resolve the XPath expression.Incorporating such a wildcard within our initial XPath would look as follows:
Practice
4. Assignment
Make sure that you add a splitter to your flow that splits messages before they are validated. To end up with valid output messages make sure to use the correct XPath. This assignment can be completed within the (Academy) project that you have created/used in the previous assignment.5. Key takeaways
- eMagiz offers two types of splitters of which the XPath splitter is used in most cases
- To determine the XPath expression in your splitter correctly remember the following things:
- The structure of the input message
- Whether the input messages has a namespace
- Always start at the root of the input message when writing an XPath outside of the transformation