The brief was to make shipment tracking faster. The actual problem was that six different systems each held a partial, differently-stale view of where a parcel was, and every one of them found out by asking.
Polling is a tax you pay per consumer
With polling, adding a seventh consumer of shipment state adds a seventh load pattern on the source database. Freshness and cost move in opposite directions: to halve the staleness you double the queries. Nobody ever wins that negotiation, so in practice the interval gets set once and then defended for years.
One log, many readers
Inverting it is conceptually simple: the scanner, the driver app and the depot terminal write events; everything else reads the log at whatever pace it needs. Consumers become independent, and adding the seventh one costs the source system nothing.
The discipline that makes this work is that events describe what happened, never what should happen next. A scan is a fact. "Notify the customer" is a decision, and decisions belong to consumers. Otherwise the log becomes a queue of instructions and you have rebuilt the coupling you were trying to remove.
Events are facts about the past. The moment one contains an instruction, you have a distributed monolith with extra steps.
What we would do differently
- Version the event schema from day one. We added versioning in month four and paid for it twice.
- Decide the retention and replay story before the first consumer, not after the first incident that needs a replay.
- Keep the projections genuinely disposable. If rebuilding one takes longer than a lunch break, it will not get rebuilt when it should be.
None of this required exotic infrastructure. It required agreeing, once, that the log is the source of truth and that everything else is a view of it.