In plain words
In event-driven design one part of the system publishes an event, such as subscription.cancelled, and any number of other parts react to it, so the publisher doesn't need to know who is listening.
Where you see it
When a Harbor customer cancelled, billing used to call deploys, email, analytics and the CRM one by one, and a slow CRM made cancelling slow. Now billing publishes subscription.cancelled, and each of the others consumes it at its own pace.
What goes wrong
- Publishing outside the transaction
Saving to the database and then publishing to the broker can fail between the two steps, leaving a change nobody hears about. Write the event to an outbox table in the same transaction and publish from there.
- Consumers that can't cope with duplicates or disorder
Brokers usually deliver at least once, and events can arrive out of order. Consumers should skip events they've already processed and check versions or timestamps before applying one.
- Nobody can see the whole flow
With events, the path of one cancellation is spread across five consumers and no single file shows it. Keep a catalogue of events with owners and schemas, and trace them end to end.
What to tell your agent
Quick check
Sign in to earn +10 XP for itHarbor's billing saves a cancellation, then publishes an event to the broker. The process crashes between the two steps. What happens?