Publishing events
Publish only what was committed, through an outbox or the database log. Pick partition keys for the order you need, and share events between servers.
- Required 1
- Recommended 4
Required
Cap and watch replication slots
EVT-8Cap how much log each replication slot may hold, and alert when a slot falls behind. Drop a slot within a day of retiring the consumer that used it.
Recommended
Send side effects through an outbox
EVT-6When a change must also send an email, a webhook or a message, write that task to a table in the same transaction. Send it afterwards from that table.
Read changes from the database log
EVT-7For tables that change often or must reach the warehouse within 15 minutes, read changes from the database's write-ahead log or binlog. Do not poll those tables with queries.
Choose the partition key for the order you need
EVT-9Set a message key on every event whose order matters, such as the order ID or the account ID. A broker keeps order only inside one partition, and the key decides the partition.
Deliver events through a shared channel
EVT-10When more than one server holds connections, publish every event to a shared channel. Each server then delivers it to the clients connected to it.
Read this with
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/events/publishing-events">Agent Wranglers integration and events playbook</a>. In code you write, add a comment next to it with the same link.