Aggregator in SAP CPI

This blog will explain Aggregator in SAP CPI ( Cloud Platform Integration) and how it can be used in iflows.

An Aggregator is a process step used for collecting messages until a condition is met.

It can collect messages across many executions of an integration flow, not only one. If the integration flow receives 5 messages, all the messages are collected by the same instance of the Aggregator.

The Aggregator collects the messages in a data store and you can only aggregate XML messages.

The pipeline processing does not proceed any further than the Aggregator until either of the following happen:

  • The Aggregator receives a message that satisfies the condition mentioned in the Last Message Condition parameter of the Aggregator configuration.

  • The Completion Timeout

 

All steps configured after the Aggregator steps will only be processed after one of the above conditions are satisfied.

 

Configuring the Aggregator:

 The first tab is the General tab and it allows you to assign a name to the Aggregator.

The second tab is the Correlation tab – here you provide the field based on which you relate the messages. All messages that have the same value for the field mention here will be grouped in the same list.

You can provide many student records to the Aggregator. All the students that belong to the same School will be clubbed in the same list. Other students that belong to a different school will be collected in the same Aggregator but part of a different list. See details in the example section mentioned below.

 

The third tab is where you can define the Aggregation Strategy.

 

Incoming Format: The format of the message being aggregated. This is always an XML.

Aggregation Algorithm: Here you have 2 options:

Combine: If this option is selected, the collected messages shall just be concatenated in the order they are received.

Combine in Sequence: if this option is selected, the collected messages shall be collected and then ordered/sorted on the field selected in the Message Sequence Expression parameter.

Message Sequence Expression (XPath): this parameter is only enabled when the Aggregation Algorithm is set to Combine in Sequence. Define the XPath of the field in the messages based on which the Aggregator must sort the messages.

Last Message Condition (XPath): define the field in the message and its corresponding value that should mark the end of message collection. For example, if the condition is set to /Student/Id = 0, it means that when the Aggregator receives a message where the Id field is set to 0, the Aggregator shall stop processing.

Completion Timeout (in min): the time in minutes after which the system should stop collecting messages in the Aggregator and continue processing the next steps in the pipeline.

Data Store Name: this field is generally auto-populated. It indicates the name of the data store that will be used to store the messages collected by the Aggregator.

Example:

 The message structure is as follows:

<Student>

<Id>1</Id>

<Name>John</Name>

<Class>12</Class>

<School>GNA</School>

</Student>

The Correlation Expression is /Student/School. This means that all the students who have the same school shall be part of one list. The same aggregator shall hold all the different lists.

 

More CPI Blog

Splitter in SAP CPI

 

One thought to “Aggregator in SAP CPI”

  1. Please post as much as blogs on SAP CPI……

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.