Urgent.News

What's breaking now, across thousands of outlets.

Tech

Compliance Event Dispatch: Auditable Email and SMS API Backoff Without Duplicate Sends

Short answer: put compliance notices on a queue, assign one stable idempotency key per notice and channel, and record every attempt before any email or SMS API call. Delivery shape Integration effort Audit quality Best fit Send inside the request handler Low on day one Weak once retries begin Disposable alerts Queue plus an append-only attempt ledger Moderate Strong and easy to query Compliance…

The compliance requirement for auditability of email and SMS notifications calls for a structured approach. First, place compliance notices in a queue. Assign a unique idempotency key per notice and channel, and log every attempt before any API call.

The delivery process should happen within the request handler on day one. Retries should begin later. Use a queue plus an append-only attempt ledger for strength and ease of querying compliance notices.

Audit records must answer specific questions: which business event triggered the notice, the selected destination and channel, content revision, start time of each attempt, and the terminal state observed. Store destination fingerprints instead of raw addresses. Keep the original business event ID separate from a provider receipt ID.

Implement a small state machine: pending, sending, accepted, delivered, permanent_failure, and suppressed. Each transition should have a timestamp and reason. Monitor a concrete sequence: an account triggers a notice at 09:00, the email adapter records acceptance on the first attempt, while the SMS adapter delays. At 09:02, the worker restarts. The notice is neither "sent" nor "failed," requiring two distinct states.

When reviewing the case, an operator sees the event ID, content revision, destinations, attempts, delays, and final outcomes chronologically. No log correlation is necessary, simplifying the process.

For Node.js event notifications, treat rate limiting as scheduling information, not permission to spin. Return a typed outcome that distinguishes acceptance, retryable delay, and permanent rejection. The dispatcher manages the retry policy, keeping transport-specific glue at the edge and making the policy testable without sending anything.

Use the server-provided delay when available; otherwise, calculate capped exponential backoff with jitter. Do not retry indefinitely. A compliance team needs a terminal state and an escalation path, not an immortal job.

Ensure a stable idempotency key is passed through the adapter when supported, plus a local uniqueness constraint on (noticeId, channel). If an API lacks an idempotent-send contract, serialize attempts for that key and reconcile ambiguous outcomes before retrying. This adds latency but avoids pretending distributed uncertainty vanished.

There is a crash window between the remote system accepting a request and the local worker storing the accepted state. Use a stable idempotency key and a local uniqueness constraint on (noticeId, channel) to close this gap. If no idempotent-send contract exists, serialize attempts for that key and reconcile outcomes before retrying.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Docker vs. Kubernetes: Which Should You Learn First?

Docker vs. Kubernetes: Which Should You Learn First? This question comes up constantly, and the honest answer is that it's not really a choice between two competing tools — it's a question of…

  • Docker packages applications into portable containers.
  • Kubernetes orchestrates Docker containers across clusters.
  • Docker is sufficient for small-scale applications, Kubernetes needed for scaling.

The Logging Dilemma

Every developer has lived through this scene: the adrenaline spike when a production incident is announced. That mix of dread about what you are going to find and frenzy to collect any piece of…

  • Logging dilemma causes frustration for developers during production incidents.
  • Team reduced log level to avoid debug log flood, but lost crucial context.
  • Dynamic per-operation log level implemented to balance information retention.

My first test: LuizaLabs

Há um tempo, no início da minha trajetória como desenvolvedor, fiz o teste técnico da LuizaLabs — foi meu primeiro contato real com um processo seletivo na área.

  • LuizaLabs technical test was first real coding interview experience
  • Task involved parsing Quake 3 log files for player stats
  • Project revisited to document logic and decisions made

More from Monday 14 September →