Skip to content
Ameen Abozaid
Planned lessonMID-029-L03

Outbox relays: polling vs CDC

  • Lesson 3 of 7
  • Mid-level
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 LOCKED so 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

sql
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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.