backenddatabasessystem-design
Keep the database update and event together
Anonymous
if a service commits a database row and then publishes an event, a crash between those steps can leave the two out of sync. one pattern is to write the event to an outbox table in the same transaction; a separate worker publishes pending rows. consumers should tolerate duplicate delivery, since a retry may publish the same event again.
0