Switch language한국어
Back to the list

Idempotent notifications with an outbox: separate detection from sending, re-check before send

TL;DR AI

Key summary

2 min read
  1. A Cloudflare Workers and D1 notification system uses the outbox pattern to deliver alerts without duplicates.

  2. Detection writes only a deduplicated outbox row instead of sending immediately.

  3. At send time, the system rechecks current data and decides to deliver, drop, or retry.

  4. A state machine tracks pending, sending, sent, dropped, retry, and failed states.

  5. The last_notified baseline is updated only after a successful send, preventing stale alerts.

Read the original