The Transactional Outbox on PostgreSQL
Writing to the database and publishing to a broker cannot be made safe by ordering them. Whichever one goes first, there is a moment where it has happened and the other has not, and processes die in moments like that. The previous post got past all of this in a single clause: we publish integration events to other services through an outbox table and a relay. That clause hides the part people actually get wrong.