32. How to choose and combine pipeline patterns
Choosing a pipeline pattern is four questions asked in order of a workload: how fresh must it be, where do the transformations belong, how does it recover and can it replay, and how is it delivered downstream. Real estates combine patterns around their workloads: one event published once can feed a handler, a stream job, a micro-batch and a nightly batch at the same time.
The clip lists the four questions in order: required freshness, where transformations belong, recovery and replay, and downstream delivery. It then asks them of Harbour Mutual's four workloads on the ClaimReported event, claims notifications, fraud scoring, finance month-end and the search index, and each lands on a different pattern: an event-driven handler, Kappa, ETL and a micro-batch. Last, the combined design: one event, published once and fanned out to all four.
The intuition: the same parcel, four recipients, four ways
Harbour Mutual's ClaimReported event matters to four teams in four ways. The letters team must post an acknowledgement within minutes, once. The fraud team must score the claim within seconds, from the customer's last month of claims. Finance books the month's claims into its ledger, with nothing unchecked ever in it. The search index must find a new claim within minutes, and takes updates in bulk.
No single pattern serves all four. Asking which pattern Harbour Mutual uses is the wrong question; asking which pattern each workload needs, and how they share one event, is the right one.
The four questions, in order
1. Required freshness. Ask how old the data may be when its reader acts on it, not how fresh it could be. A day or more allows a scheduled batch (pages 24 and 25); minutes allow a micro-batch (page 27) or anything that streams; seconds need each event processed as it arrives (page 26). Freshness comes first because it rules out whole families of patterns.
2. Where the transformations belong. Before the target, when a rule protects every reader and the readers cannot be kept from a raw zone (ETL); inside the platform, when raw data can be restricted and rules change (ELT); in a stateful stream job, when each result needs remembered history; in small batches, when the sink takes bulk writes; in a handler, when each event is one action.
3. Recovery and replay. How is a failure fixed, and can past results be recomputed? A batch is run again for its period; a micro-batch or stream job reads on from its checkpoint; recomputing after a logic change means replaying a retained log (Kappa, page 29), or keeping a batch of record beside fresh figures (Lambda, page 28). Some work must never be replayed: a letter posted is posted.
4. Downstream delivery. If each event starts a business action, route it to an idempotent handler (page 31). If several independent consumers need the same event, fan it out with one subscription each (page 30), so no consumer's failure stops another.
| Workload | Freshness | Transformations | Recovery and replay | Pattern |
|---|---|---|---|---|
| Claims notifications | Minutes: a micro-batch is fresh enough, and so is anything that streams. | In a handler per event: there is nothing to aggregate, only one action to take for each claim. | Never by replaying: a replay would send every letter again. A handler retries, and remembers what it has done. | Event-driven |
| Fraud scoring | Seconds: only processing each event as it arrives is fresh enough. | In a stateful stream job: each score needs the customer's recent claims, kept as the job's state. | Its logic changes and every score must be recomputed: keep the log and replay it through the new job. | Kappa architecture |
| Finance month-end | A day is enough: a scheduled batch. | Before the target: its readers cannot be kept out of a raw zone, so the rules run on the way in. | The batch is the book of record: a failed load is run again from the source for the period. | ETL |
| Search index | Minutes: a micro-batch is fresh enough, and so is anything that streams. | In small batches: the sink takes bulk writes, so events are grouped before they are written. | From its checkpoint: the next batch reads on from the last committed offset, and a rebuild reads the log again. | Micro-batch |
By hand
Ask the four questions of each workload in turn, and write down the patterns still standing after each.
| Workload | What it needs |
|---|---|
| Claims notifications | Send the customer an acknowledgement letter within five minutes of reporting a claim, exactly one per claim. |
| Fraud scoring | Score every claim within ten seconds, using the customer's claims of the last 30 days; the features change every quarter and the scores must then be recomputed. |
| Finance month-end | Load the month's claims into the ledger's staging, read by the whole finance team, with nothing unvalidated or unconverted ever in it. |
| Search index | Keep the claims handlers' search index within five minutes of the portal; the index takes bulk updates and throttles single writes. |
- Claims notifications: minutes are fresh enough, and each claim is one letter. Which pattern is left?
Predict the result, then check it
Event-driven: a handler per event, made idempotent; never replayed, because a replay would post every letter again. - Fraud scoring: seconds, state over 30 days, and features that change every quarter. Which?
Predict the result, then check it
Kappa architecture: a stateful stream job, recomputed by replaying the retained log. - Finance month-end: a day is enough, rules before a target the whole team reads, and the batch is the book of record. Which?
Predict the result, then check it
ETL. - Search index: minutes, and a sink that throttles single writes. Which?
Predict the result, then check it
Micro-batch, every few minutes, written in bulk. - How do the four get the same event?
Predict the result, then check it
It is published once and fanned out: four subscriptions, four offsets, four dead-letter queues.
What you found: Four workloads, four patterns, one event: Event-driven, Kappa architecture, ETL and Micro-batch, joined by a fan-out.
- Ask freshness first
- Without it: Teams argue about tools before agreeing what the reader needs, and build streaming for a monthly report.
- Then ask where the rules must run
- Without it: Unchecked or sensitive data lands where readers can see it.
- Then ask how it recovers
- Without it: The first failure or logic change becomes a project instead of a rerun or a replay.
- Last, ask how it is delivered
- Without it: Consumers are chained, and one outage stops them all.
- An organisation should standardise on one pattern.
- In fact: Harbour Mutual's four workloads on one event need four different patterns; a standard should be the questions, not the answer.
- Fresher is always better.
- In fact: Freshness costs overhead (page 27) and operations; finance's figures are read once a month and gain nothing from seconds.
- Streaming replaces batch.
- In fact: Of the four workloads, one is a nightly batch, one a micro-batch, and only one needs each event in seconds.
Combining patterns around the workload
Combine at the event, not inside a job. Publish each business event once, under a contract (page 17), to a log that keeps it long enough to replay. Let each workload subscribe with its own pattern: a handler, a stream job, a micro-batch, or a capture to the lake that a nightly batch reads. Each can then fail, change and be replayed without asking the others.
Design notes
- Write each workload's answers down as facts (freshness, rules, recovery, delivery): chapter 31's decision exercise does exactly that, and anyone can check the choice against them.
- Revisit the choice when a fact changes: a monthly report that becomes daily may move from ETL to a micro-batch without changing anything else.
Why it matters
Most pipeline failures in practice are not failures of a tool but of a choice made for the wrong reason: streaming because it is modern, batch because it is familiar, one pattern because it is the standard. Four questions asked in order make the reason explicit, and the combination makes each workload's choice independent of the others'.
On Azure (checked against Microsoft Learn on 24 October 2026)
- One combination: the portal publishes ClaimReported to Azure Event Hubs; Azure Functions handles the letters; Azure Databricks Structured Streaming scores fraud and, with a
processingTimetrigger, updates the search index; Event Hubs Capture lands the events in the lake, where a scheduled Azure Data Factory pipeline loads finance's staging. Each reader is its own consumer group.
Where it goes wrong
- Tool first. The platform is chosen before anyone asks how fresh the data must be.
- One pattern for everything. The monthly report runs on a stream nobody needed, or the fraud model waits for a nightly batch.
- Combining inside one job. One job feeds four consumers and fails for all four.
- Replaying into the world. A replay meant for derived data reaches the letter handler.
- Ask the four questions in order and say what each rules out.
- Choose a pattern for a workload from its facts, and defend it.
- Combine several patterns around one published event.
- Spot a choice made for the wrong reason.
Check yourself
Choose an answer to each question, then press Check.
Sources
The works this page draws on, summarised in its own words rather than quoted. Read them for the full argument.
- M. Kleppmann, Designing Data-Intensive Applications (O'Reilly, 2017), chapters 10 to 12Batch, stream and derived data, and building systems by combining them around logs.
- T. Akidau et al., "The Dataflow Model", Proceedings of VLDB, 2015Correctness, latency and cost as the trade every pipeline makes.
- G. Hohpe and B. Woolf, Enterprise Integration Patterns (Addison-Wesley, 2003)Combining messaging patterns around business events.
Practise it
The chapters that put this theory to work on Harbour Mutual and Kestrel:
- Chapter 29: Integration patterns: batch, streaming, APIs and sharing
- Chapter 30: Lambda and Kappa: architectures for streaming
- Chapter 31: Pipeline patterns: choosing and combining
The tools to try it in:
- Pipeline patterns lab · Run the same claim events through eight pipeline patterns and see latency, overhead, a consumer failing, a delivery repeated and a logic change replayed.
- Stream lab · Run one claims feed as batch, Lambda and Kappa side by side, inject a late correction and replay the log.