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.
Lead Telecom & Routing Architect · Lausanne, CH
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.
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
- Webhook Endpoint Health Probes and Failover Gate Verification
How to probe webhook endpoint health, set failover gates, and verify partner route readiness before committing SMS volume to a new channel.
- Webhook Retry Storm Control: Backoff and Jitter Policy Comparison
Compare retry backoff and jitter policies that stop synchronized webhook storms across partner routes while preserving DLR delivery SLAs and rate-limit headroom.
- Webhook Endpoint Failover: DNS Cutover Gates for Partner Route Comparison
Decide when to fail over webhook ingestion across regions or providers without losing events, duplicating debits, or breaking signature validation.












