Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 


Enterprise Integration Patterns (EIP) help in solving recurring problems faced in the integration of enterprise applications.  This article introduces the Aggregator – one of the Enterprise Integration patterns in the context of SAP NetWeaver Process Orchestration.

Applies to

SAP NetWeaver Process Orchestration EhP1 for SAP NetWeaver 7.3 SP5


Abdul-Gafoor Mohamed & Prashant Gautam

Product Management, SAP NetWeaver BPM, SAP Labs

The Aggregator Pattern in Process Orchestration

Enterprise Integration Patterns – The Aggregator

Enterprise Application Integration (EAI) is an integration framework composed of a collection of technologies and services that form a middleware, enabling the integration of systems and applications across an enterprise.[1] A twenty-first century enterprise typically consists of tons of distributed applications, varying percentages of which may be homegrown, acquired, legacy or even a combination of these.

Enterprise Integration Patterns (EIP) are design patterns that help in solving recurring problems faced in the integration of enterprise applications.  One of the message routing patterns – the Aggregator –  is a stateful filter that is used to analyze and store input messages until a complete set of (related) messages are received.  It can then produce a single refined message from the messages that were received.  It is used in cases where subsequent message processing is contingent upon the successful processing of multiple input messages. Thus, the Aggregator helps address this question:

“How do we combine the results of individual but related messages so that they can be processed as a whole?”[2]

Dealing with asynchronous messaging systems presents challenges like correlating the messages, particularly due to the fact that the incoming messages may arrive in any order.  While some of the other routing patterns can be stateless, the aggregator needs to store each incoming message until the set of messages is complete for further processing.  The aggregation is limited to a completion condition, either time bound or quantity bound.

Let us consider the example of a stationery manufacturer, Krafty.  One division of the factories of Krafty manufactures stationery supplies like coloured pencils and graphite writing pencils.  Graphite pencils are manufactured and placed into bins on a conveyor belt so that they can be packed by a machine.  Each package contains 10 graphite writing pencils.  Krafty would like to increase throughput without compromising on quality.

Figure 1. An illustration of the Aggregator pattern

An Integration Scenario for the Aggregator

The aggregation is not dependent on the order of messages received, which means the Aggregator may receive related messages at any time (within a reasonable limit) and in any order.  Each time the Aggregator receives a new message, it should check if the message is part of an existing aggregate and create a new aggregate if a related aggregate doesn't exist, and then add the message to the appropriate aggregate.

In our example for the graphite writing pencils, we need to aggregate a set of 10 pencils.  The pencils are collected into the next bin and once the count reaches 10, the bin is conveyed to the machine that packages them.

SAP NetWeaver Process Orchestration Solution Outline

Figure 2. An integration scenario for the Aggregator pattern

As depicted in Figure 2, we are dealing with these three integration configurations:

  • Integration Configuration1 (ICO1) – A message flow can be triggered in Business System S1 that flows through SAP NetWeaver PI (AEX) to SAP NetWeaver BPM.
  • Integration Configuration2 (ICO2) – For triggering intermediate message(s) that flow to SAP NetWeaver BPM via SAP NetWeaver PI.
  • Integration Configuration3 (ICO3) – For sending the aggregation to SAP NetWeaver PI (AEX) from SAP NetWeaver BPM using a File Adapter.

Note: The message flow from Business System S1 could also be simulated by using the Web Services Navigator, details of which can be found in the SAP NetWeaver Web Services Navigator documentation.

SAP Process Orchestration Scenario

Figure 3. A generic SAP Process Orchestration scenario sequence

The Integration Flows have to be created and activated using the same interfaces that were used in the Business Process.  The generic scenario referenced above applies to most Enterprise Integration patterns.

Note: Only XI 3.0 compatible stateless interfaces are supported.

Process Modeling in SAP NetWeaver BPM


  • The service interfaces to be used in the process model – Starting Interface and Automated activity – should be created first and then imported from the SAP NetWeaver PI Enterprise Service Repository.
  • For testing the BPM Process from the BPM Process repository, the UME action SAP_BPM_TRIGGER_EVENT should be assigned to the specific user role.

Process Model

Figure 4. An aggregator scenario modeled in SAP NetWeaver BPM

The Process Model for a Aggregator scenario is shown in Figure 4.  The steps for modeling the process are enumerated below:

  • The Pattern starts with a service interface with the message counter reset to zero.
  • As long as the counter is within defined bounds, incoming message(s) that match the correlation key are collected.
  • The message counter is incremented for each collected message (matched correlation key).
  • Once the counter has met the completion condition, all the collected messages are processed(aggregated) and this aggregation is sent to the receiver.


  • Use the ‘XI’ service reference instead of ‘WS’ in the configuration settings of the automated activity. The Sender Component also needs to be specified.
  • Use the SAP NetWeaver PI Integration Flow Designer to create the configuration objects in SAP NetWeaver PI
  • Please refer to detailed information on Process Modeling using SAP NetWeaver BPM.

[1] Enterprise Application Integration, Wikipedia

[2] Gregor Hohpe & Bobby Woolf, Enterprise Integration Patterns. 2003

[3] Inbound and Outbound are terms used with reference to the application, in this case SAP NetWeaver BPM.