Skip to content
Exercise · Messaging patterns · lesson 5 of 9

Exercise: an outbox relay

A service has placed an order and must tell the broker about it. If it writes the order and publishes the message separately, it can crash between the two steps: the order is in the database, and the message is nowhere: this is how a dual write breaks. So the service inserts a row into the outbox table in the same transaction as the order. A relay later reads these rows and publishes them.