Writing to Postgres then publishing to Kafka/SQS can fail in between, leaving DB updated without an event (or vice versa). With the Transactional Outbox pattern, insert the domain row and an outbox event row in the same DB transaction; a relay polls (or tails WAL via CDC) and publishes at-least-once to the broker, while idempotent consumers deduplicate and DLQs capture poison messages.
Follow-up Interview Question · Compare polling the outbox table vs Debezium/WAL CDC on throughput and operational complexity.