Skip to Content

Handling Bulk Messages

test
0 %
Handling Bulk Messages
Details

Handling Bulk Messages

2019-12-17
Learn how to handle messages individually, when receiving multiple messages as a part of one big message.

You will learn

  • How to split a message containing multiple messages into individual messages
  • How mapping works with bulk messages

Assume that a customer orders multiple items. The input XML will then contain all the item information. In this exercise, we shall separate the items and process them individually.


Step 1: Process a bulk message
  1. Let us change our input message and add 2 more items to it.

    • Add the following text to your input message:

    <item>
    <ProductID>RPD4044544</ProductID>
    <ProductDescription>Keyboard</ProductDescription>
    <Quantity>1</Quantity>
    <ItemValue>1057</ItemValue>
    </item>
    
    <item>
    <ProductID>RPD4044545</ProductID>
    <ProductDescription>Webcam</ProductDescription>
    <Quantity>1</Quantity>
    <ItemValue>1057</ItemValue>
    </item>  
    
    

    Once done, your message should look like:

    New Input
  2. Execute your flow with the new message. You will see that the output mail only contains 1 item information:

    Bulk items ignored
  3. This is because the cardinality of the Item field is set to 1..1.

    Incorrect Cardinality
  4. Edit the XSD.

    • Go to the Item field and add minOccurs="1" maxOccurs="unbounded" to it as attributes as follows:

    Change Cardinality
    • Go to the integration flow’s Resources View and delete both Order.xsd and WarehouseOrder.xsd.
    Delete XSDs
    • Go to the Message Mapping and reimport the edited XSD.
    Add New XSD

    In spite of having deleted the XSD, SAP Cloud Platform Integration preserves the maps.

    • Check if all the maps are configured.

    • Save, deploy and execute your flow. You should get one composite mail containing all product information:

    Combined Mail
Log on to answer question
Step 2: Split message
  1. Add a Splitter step to the integration flow:
    • Click on the design Palette.
    • Choose Message Routing.
    • Go to Splitter.
    • Choose General Splitter.
    Choose General Splitter
    • Drag it on to the execution pipeline between the Router and XML to JSON Converter step on the branch for KWA2MNWC2U.
      Name it Split Orders.
    Add General Splitter
    • Configure the General Splitter as follows:
    Field Value
    Expression Type XPATH
    XPath Expression /orders/order/items/item
    Grouping 1
    Streaming Checked
    Parallel Processing Unchecked
    Stop on Exception Checked
    • Save, deploy and execute your flow. You should get one 3 individual mails containing individual product information:
    Separate Mail

    Play around with the different types of splitters and different configuration, to understand how the results differ.

What do you need to change to make sure message mapping consider multiple occurrences of an element in SAP Cloud Platform Integration?
×

Next Steps

Back to top