Outbox relays: polling vs CDC
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
choose how outbox rows reach the broker.
Planned topics
- Polling relay: a scheduled job selects unsent rows (
ORDER BY created_at), publishes, marks them sent. Simple; adds latency and database load. - With several relay instances, use
FOR UPDATE SKIP LOCKEDso they do not take the same rows. - CDC (change data capture, for example Debezium) reads the database log and publishes row changes. Low latency, no polling, but more infrastructure.
- Both give at-least-once. Ordering per aggregate must be preserved.
- Delete or archive sent rows, or the table grows forever.
Draft outline details
Demonstration
SELECT * FROM outbox WHERE sent_at IS NULL
ORDER BY created_at LIMIT 100 FOR UPDATE SKIP LOCKED;Check your understanding
What does SKIP LOCKED allow?
Show answer
Several relay instances to work on different rows at once.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.