IOSOR Learn

Webhook Endpoint Graceful Shutdown Drain Gate

Drain in-flight webhook deliveries during endpoint maintenance without event loss or partner retries, then verify failover behavior before cutover.

Oleksandr (Alex) Petukhov — IOSOR Telecom Expert
✓ Verified by IOSOR ExpertOleksandr (Alex) Petukhov

Lead Telecom & Routing Architect · Lausanne, CH

IOSOR Expert · Q&A

Operators must drain in-flight webhook deliveries during endpoint maintenance without losing events or triggering partner retries, then verify partner route failover behavior before cutover.

Drain Gate Activation Criteria

Enable the drain gate when a maintenance window is scheduled or an endpoint health check reports sustained latency above 2 s or error rate above 1 %. The gate pauses new outbound webhook dispatches while allowing in-flight requests to complete or time out per their individual retry policy. A configurable max-drain duration (default 120 s) prevents indefinite hold; any deliveries still pending after expiry are re-queued with exponential backoff.

In-Flight Delivery Tracking

Each webhook payload carries a correlation-id and attempt-count header. The drain gate inspects the delivery store for entries with status 'dispatched' and attempt-count < max-retries. These entries are marked 'draining' and excluded from new dispatch cycles. DLR receipts arriving during drain update the same correlation-id, ensuring idempotent completion. No second debit occurs because the ledger posts only on terminal DLR status.

Partner Retry Suppression

While draining, the endpoint returns HTTP 503 with Retry-After set to the remaining drain window. Partners honoring Retry-After defer retries, avoiding duplicate deliveries. For partners that ignore Retry-After, the circuit-breaker pattern (see related) trips after three rapid 5xx responses, suppressing further outbound calls until the gate lifts. This prevents retry storms that could mask the real endpoint health.

⚡ IOSOR Expert · Q&A · Verified partners (×44)

Failover Verification Procedure

Before cutover, spin up a shadow endpoint mirroring the production contract. Replay the last 500 drained payloads against the shadow and compare DLR receipt signatures, latency percentiles (p50, p95), and template-render fidelity. Any divergence > 5 % on latency or a single signature mismatch blocks cutover. Use the partner comparison tool to validate route parity across corridors.

Observability & Alerting

Emit drain-gate metrics: gate-active (boolean), in-flight-count, drained-completed, drained-requeued, partner-retry-suppressed. Alert on gate-active > max-drain-duration or in-flight-count not decreasing for 30 s. Correlate with webhook endpoint health dashboards to distinguish drain backlog from genuine endpoint degradation.

Start with IOSOR

Compare verified partner routes for your channel and corridor using the partner route comparison tool. Checklist: 1) Confirm drain gate config matches SLA. 2) Validate shadow endpoint parity. 3) Verify circuit-breaker thresholds. 4) Ensure alerting covers drain-stall scenarios. 5) Document rollback steps. Related: Webhook Circuit Breaker on Endpoint Failure, Webhook Endpoint Health Monitoring and Alerts, Webhook Partner Cutover Runbook Validation Gate.

IOSOR takeaway

Enable the drain gate when a maintenance window is scheduled or an endpoint health check reports sustained latency above 2 s or error rate above 1 %. Correlate with webhook endpoint health dashboards to distinguish drain backlog from genuine endpoint degradation (/tools/brief · DLR / webhook).

Was this guide helpful?

Related guides

VERIFIED BY IOSOR EXPERT · B2B ROUTING, SLA & PROVIDER Q&A

IOSOR Expert — Verified Q&A & B2B Messaging Decisions

Every Q&A decision below is audited by the IOSOR Telecom Architecture Expert against live 90-day uptime telemetry, carrier compliance rules (10DLC, DLT, GDPR), and real partner TCO.

All Q&A Triggers
#01 · Compliance & Sender ID📖 Knowledge hub · US A2P / 10DLC

US A2P / 10DLC

“Why do US 10DLC TCR campaigns get rejected and which partner handles fast onboarding?”

✓ Verified by IOSOR Expert

10DLC brand and campaign programs for US A2P traffic — not general privacy compliance.

All Q&A Triggers
#02 · OTP & verification📖 Knowledge hub · India DLT

India DLT

“How do engineering teams prevent India TRAI DLT template scrubbing drops on OTPs?”

✓ Verified by IOSOR Expert

DLT and PE-TM registration for India A2P — not an India corridor coverage guide.

All Q&A Triggers
#03 · OTP & verification📖 Knowledge hub · Verify / OTP

Verify / OTP

“How do we eliminate OTP p95 timeout spikes and trigger a 20–30s multi-rail fallback?”

✓ Verified by IOSOR Expert

Login codes without chaos: abuse, latency, and cost control.

All Q&A Triggers
#04 · Transactional email📖 Knowledge hub · Email

Email

“Why do password reset and 2FA emails land in Spam when sharing bulk marketing IPs?”

✓ Verified by IOSOR Expert

Transactional email alongside SMS, voice, and WhatsApp in one routing architecture.

All Q&A Triggers
#06 · WhatsApp Business📖 Knowledge hub · WhatsApp & RCS

WhatsApp & RCS

“How do Meta per-conversation fees and template pauses impact WhatsApp Business TCO?”

✓ Verified by IOSOR Expert

Rich channels when profiles and templates are ready: honest setup.

All Q&A Triggers
#08 · Failover & backup routing📖 Knowledge hub · Failover & rails

Failover & rails

“How do we keep a second standby provider warm for failover at $0/month idle cost?”

✓ Verified by IOSOR Expert

Ordered backup paths when a primary rail fails - distinct from DLR status truth.

All Q&A Triggers