CPI iFlows
BTP & Integrationadvanced

BTP CPI iFlows Part 5: Router, Splitter, Gather, Multicast and Aggregator Patterns

Key takeaway

Apply enterprise integration patterns in Cloud Integration: content-based routing with Router, splitting large messages (General/Iterating Splitter), recombining with Gather, parallel/sequential Multicast, and Aggregator for collecting related messages — including error behavior and performance considerations.

Explanation

📌 KEY POINTS
✅ Router sends a message down one route based on conditions (XPath or expressions); define a default route.

✅ Splitter breaks a message into parts (e.g. per line item); Gather recombines results.

✅ Multicast sends copies to several branches (parallel or sequential).

✅ Aggregator collects related messages over time (by correlation) into one.

⚠️ Splitting with "stop on exception" off can process half a file silently — define error behavior explicitly.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Part 4 covered mapping. Now patterns.

━━━━━━━━━━━━━━━━━━━━
▶ 1. ROUTER

  • Conditions, default route, error route.

━━━━━━━━━━━━━━━━━━━━
▶ 2. SPLITTER

  • General vs iterating; grouping; streaming.

━━━━━━━━━━━━━━━━━━━━
▶ 3. GATHER

  • Combine split results.

━━━━━━━━━━━━━━━━━━━━
▶ 4. MULTICAST

  • Parallel vs sequential.

━━━━━━━━━━━━━━━━━━━━
▶ 5. AGGREGATOR

  • Correlation, completion condition, timeout.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Route by country with a default route.
  2. Split a 20,000-record file in groups of 500.
  3. Gather results and report errors.

✅ CHECKPOINT: every record processed or reported, none silently lost.

Code example

ABAP Code
===== PATTERNS =====Router: /Order/Country = 'DE' → route DE | 'US' → route US | default → error/alertGeneral Splitter: XPath /Orders/Order, grouping 500, streaming ✔, stop on exception (per requirement)Gather: combine strategy "concatenate" → summary reportMulticast: parallel → CRM + DWH + MailAggregator: correlation ${header.batchId}, completion when lastMessage='true' or timeout 10 min

Real project scenario

A file with 20,000 records was split in a flow without a defined error strategy; failed items were silently dropped. Adding exception handling per split item, a gather summary and alerts ensured every record was processed or reported.

Common mistakes

  • No default route.
  • Undefined split error behavior.
  • Unthrottled parallelism.
  • No gather summary.
  • Aggregator without timeout.

Best practices

  • Default + error routes.
  • Explicit split error strategy.
  • Throttle parallel calls.
  • Summaries.
  • Completion conditions.

Interview angle

Questions: "Router vs multicast?", "How do you process large files?", "What is an aggregator?"
Strong answer: patterns, configuration, error behavior, performance.

Practice this lesson

Quick check

1. An iFlow must break an incoming array of 500 line items into individual messages, processing and routing each item separately while keeping the overall exchange context. Which splitter type is most appropriate when each resulting message needs to flow through the remaining pipeline steps sequentially, one at a time?

2. A 20,000-record file was split and failed items were silently dropped. What should be added?

3. A CPI iFlow must route incoming messages to three different receivers, and every message that matches the routing conditions should be sent to all matching branches simultaneously without stopping at the first match. Which flow element configuration achieves this?

Interview questions

1. What are the most important design decisions, trade-offs, and best practices in CPI iFlows?

Answer it in your own words first, then compare.

2. Design an iFlow that distributes large order files to country-specific systems and reports results.

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics