~learn.
0:00 / 1:26
W03 · Messaging and async

"I was charged and never got my food." One query answers it.

transcript

A customer writes in: I was charged, and I never got my food. Support has to answer. What actually happened?

About 2 percent of orders end in a dispute like this. So where do you look? The orders table? It only shows the current state. Not how it got there. The logs? Scattered across services, hard to line up. Payments? A separate system. Answer: we can't tell what happened.

So every service also publishes an audit event, for every state change. An audit consumer writes them to TimescaleDB. Immutable. Kept 2 years. Indexed by order ID, actor and time. So support runs one query.

18:30, the customer places the order. A second later, payment confirmed. So yes, they were charged. The restaurant accepts at 18:31. A driver picks it up at 18:50. And then nothing. At 19:15, still no delivery event. The gap points straight at a driver issue.

No guessing across systems. The timeline shows every step, and who caused it. The dispute is resolved in minutes, not hours.

A table tells you where an order is. Only a history tells you how it got there. If people can dispute it, record every step.

Full breakdown in the lecture.