Skip to main content
Version: 4.17.2

Aggregate component

The Aggregate component combines multiple incoming messages containing data into a single message.

Configuration

The Aggregate component has the following basic configuration options:

File Type

The type of files in the messages to be aggregated.

Options

  • XML (default)
  • JSON

Only valid XML or JSON files can be aggregated. When aggregating XML files, the messages are wrapped in a root element named Aggregated to produce a valid XML file. JSON files are aggregated into an array.

In the Flow Manager - Transactions the aggregated message will continue on the breadcrumbId of the first message that triggered the aggregation.

XML escape characters

It is important to escape invalid characters in XML element values:

  • < escape with &lt;
  • > escape with &gt;
  • & escape with &amp;

Completion method

The method determines when the aggregated message continues to the next component.

Options

  • Count (default)
  • Interval

It's based on the amount of messages (Count) or on a time interval (Interval).

Completion count

The maximum amount of messages to aggregate before sending them to the next component.

note

Completion count timeout

The maximum duration (in milliseconds) the component will wait after receiving the last message before sending the aggregated message to the next component, if the Completion count has not yet been reached.

note

Completion interval

The duration (in miliseconds) that the Aggregate component waits before sending the aggregated message to the next component.

note
start completion interval

The first Completion interval begins when the flow is installed and running in the backend.

Using count with XML

In this example the Aggregate component is configured as follows:

Imagine you want to aggregate multiple messages, each containing movie data formatted as shown in the example XML file below. The Aggregate component then receives five of these XML files at 10-second intervals.

<Movie>
<Title>Title</Title>
<Producer>Producer</Producer>
<Release_Date>Release Date</Release_Date>
<Duration>Duration</Duration>
</Movie>

Once the second XML file is received the Completion count of 2 is met, and the first aggregated XML is sent to the next component. It contains two movie datasets, for example:

<Aggregated>
<Movie>
<Title>Deadpool</Title>
<Producer>Marvel Entertainment</Producer>
<Release_Date>February 8, 2016</Release_Date>
<Duration>108 Minutes</Duration>
</Movie>
<Movie>
<Title>Captain America: Civil War</Title>
<Producer>Marvel Studios</Producer>
<Release_Date>April 12, 2016</Release_Date>
<Duration>147 Minutes</Duration>
</Movie>
</Aggregated>

The count resets, and once the fourth XML file is received the Completion count of 2 is met again. The second aggregated XML is sent to the next component. It also contains two movie datasets, for example:

<Aggregated>
<Movie>
<Title>Star Wars: The Force Awakens</Title>
<Producer>Lucasfilm Ltd.</Producer>
<Release_Date>December 14, 2015</Release_Date>
<Duration>136 Minutes</Duration>
</Movie>
<Movie>
<Title>Suicide Squad</Title>
<Producer>DC Entertainment</Producer>
<Release_Date>August 1, 2016</Release_Date>
<Duration>123 Minutes</Duration>
</Movie>
</Aggregated>

The count resets again, but the fifth message alone is insufficient to meet the Completion count of 2. The Aggregate component will wait 30 seconds (as defined by the Completion count timeout) for a sixth message to arrive. Since the sixth message never arrives within this time period, the third aggregated XML is sent to the next component after the timeout. It contains one movie dataset, for example:

<Aggregated>
<Movie>
<Title>Titanic</Title>
<Producer>James Cameron</Producer>
<Release_Date>December 19, 1997</Release_Date>
<Duration>195 Minutes</Duration>
</Movie>
</Aggregated>

Using interval with JSON

In this example the Aggregate component is configured as follows:

Imagine you want to aggregate multiple messages, each containing book data formatted as shown in the example JSON file below. Right after the flow is installed the Aggregate component receives five JSON files at 3-second intervals.

{
"title": "title",
"author": "author",
"pages" : "pages",
"year" : "year"
}

After the first Completion interval of 10 seconds has passed, the first aggregated JSON is sent to the next component. It contains three book datasets, for example:

[
{
"title": "Molloy, Malone Dies, The Unnamable, the trilogy",
"author": "Samuel Beckett",
"pages": 256,
"year": 1952
},
{
"title": "The Decameron",
"author": "Giovanni Boccaccio",
"pages": 1024,
"year": 1351
},
{
"title": "Ficciones",
"author": "Jorge Luis Borges",
"pages": 224,
"year": 1965
}
]

After the second Completion interval of 10 seconds has passed, the second aggregated JSON is sent to the next component. It contains two book datasets, for example:

[
{
"title": "Wuthering Heights",
"author": "Emily Bront",
"pages": 342,
"year": 1847
},
{
"title": "The Stranger",
"author": "Albert Camus",
"pages": 185,
"year": 1942
}
]
Last update on Nov 26, 2024