Kafka & events · Trade-off defence
A polling outbox, or the database log?
To publish events reliably from a service with a PostgreSQL database, do you poll an outbox table or capture changes from the database log?
Trade-off defence · outbox with a relay, or change data captureIllustrative scenario, not a real incident
Design review: how the billing service will publish invoice events to Kafka
The billing service keeps invoices in PostgreSQL, across three tables. Accounting and email need an event for every invoice that is issued or voided, in order for each invoice. A delay of a few seconds is acceptable.
The team has agreed that the service will not write to the database and to Kafka separately. Four engineers run the service. Nobody in the company operates a log connector today, and nights are covered by alerts alone.
What the dashboards and logs show
- Volume
- about 40 invoice changes a second at peak
- Database disk
- 100 GB, 60 GB free
- Night batch
- writes about 20 GB of WAL an hour, 01:00 to 04:00
- Event contract
- one event per invoice change, with its lines included
Take a side · neither is wrong, and your defence is what is scored
Before you decide, argue one side. Which will you defend?
Your rubric score, the model answer, the follow-up questions and the related lessons appear once you have answered the last step.