Stream lab
One claims feed, three architectures. Read the log event by event as a nightly batch, as Lambda (a speed layer and a batch layer) and as Kappa (one streaming job over a log you can replay), then inject a late correction and see latency, cost and which views agree.
| Architecture | Minutes until a claim shows | Windows right before the batch | Windows right after it | Events read | Cost | Code paths |
|---|---|---|---|---|---|---|
| Batch | 808 | 0 of 4 | 4 of 4 | 12 | 5.2 | 1 |
| Lambda | 1 | 3 of 4 | 4 of 4 | 24 | 30.4 | 2 |
| Kappa | 1 | 3 of 4 | 3 of 4 | 12 | 25.2 | 1 |
Windows are by event time, when the claim happened. A streaming job keeps a window open until its watermark, the latest event time it has seen less the allowed lateness, passes the window's end; anything that arrives for a closed window is dropped. The nightly batch reads the whole log, so it is always right, but only once a day.
Used in
- Chapter 29 · Integration patterns: batch, streaming, APIs and sharing
- Chapter 30 · Lambda and Kappa: architectures for streaming
- Chapter 31 · Pipeline patterns: choosing and combining
Glossary: Lambda architectureKappa architectureEvent timeWatermark