What it is
An aggregator is a stateful component that collects several related messages and combines them into one. It is the counterpart to a splitter, reassembling pieces that belong together.
How it works
- Each incoming message carries a correlation id marking its group.
- The aggregator holds messages until a completion condition is met.
- It then emits a single combined message and clears that group.
Why it matters
- Lets downstream steps act on a whole instead of fragments.
- Combines responses from multiple services into one answer.
- Bridges fine grained events into coarse grained results.
The hard part is deciding when a group is complete. Strategies include waiting for a known count, waiting until a timeout, or stopping on the first acceptable item. Because it holds state, an aggregator must handle late, missing, or duplicate messages, and it needs memory limits so an incomplete group does not grow forever.
Key idea
An aggregator gathers correlated messages and emits one combined result once a completion condition is satisfied.