Local service and operations rehearsal completed
Webhook delivery queue
A durable webhook service with signed requests, worker leases, bounded retries, endpoint controls and a delivery history.
Implementation
Event acceptance and destination jobs commit together. Workers claim a lease, send outside the transaction, and finish only if their lease token is still valid. A restarted service can recover expired claims.
The sender signs each request with HMAC-SHA256, retries transport and selected HTTP failures, and retains terminal attempts for inspection. Operators can pause destinations and replay dead letters.
A local receiver fixture verifies signatures and deduplicates event IDs. One endpoint accepts an event, then closes the connection before sending its first response. The replay exercises the sender's uncertain-delivery case.
Checked online SQLite snapshots, restore into a new directory, and a periodic backup command are included. An executed operations rehearsal covers abrupt process exits, recovery and rejected inputs.
Inputs and assumptions
- Included pump-inspection events are synthetic. The three-worker demonstration uses four local endpoints and a one-request limit per endpoint.
- Python 3.12 and SQLite on one host. The earlier TypeScript/PostgreSQL distributed plan is not included.
- Delivery is at least once. Receivers must deduplicate business effects by event ID; the queue cannot infer whether a lost response followed a commit.
Recorded results

Machine-readable result summary
{
"fixture": "synthetic pump inspection events; fresh local HTTP receiver",
"events": 13,
"jobs": 37,
"workers": 3,
"per_endpoint_inflight": 1,
"counts": {
"dead": 1,
"delivered": 36
},
"attempts": 49,
"elapsed_seconds": 1.695,
"outcomes": {
"delivered": 36,
"dead": 1,
"retry": 12
},
"receivers": {
"normal": {
"requests": 12,
"business_effects": 12
},
"response-loss": {
"requests": 24,
"business_effects": 12
},
"slow": {
"requests": 12,
"business_effects": 12
}
},
"assertions": {
"all_jobs_terminal": true,
"response_loss_retried": true,
"receiver_effects_deduplicated": true,
"permanent_rejection_dead_lettered": true
},
"measurement_note": "Elapsed time includes fixture shutdown; this small local scenario is not a throughput benchmark."
}Verification
28 of 28 tests passed. Failures: 0. Errors: 0.
28 tests pass for claims, lease recovery, stale completions, retries, signatures, retention, destination restrictions and authorization. The executed response-loss scenario records one receiver effect for each retried event. A separate operations rehearsal passes 15 expected-outcome checks, including process crashes, checked snapshots, restore and a finite backup schedule.
python verify.py python demo.py python operations_rehearsal.py
Executed test cases
- test_queue.HttpTests.test_lost_response_retries_same_id_with_one_business_effect
- test_queue.HttpTests.test_operator_api_auth_and_event_acceptance
- test_queue.HttpTests.test_redirect_is_not_followed
- test_queue.HttpTests.test_timeout_completes_attempt_as_retry
- test_queue.HttpTests.test_valid_signature_and_invalid_signature
- test_queue.PolicyTests.test_credentials_fragment_and_http_are_rejected
- test_queue.PolicyTests.test_defaults_deny_all_destinations
- test_queue.PolicyTests.test_dns_mixed_public_private_is_rejected
- test_queue.PolicyTests.test_global_address_is_returned_for_pinned_connection
- test_queue.PolicyTests.test_ipv6_mapped_and_linklocal_are_rejected
- test_queue.PolicyTests.test_test_exception_is_exact_origin
- test_queue.QueueTests.test_accept_is_atomic_across_destinations
- test_queue.QueueTests.test_bad_payloads_are_rejected
- test_queue.QueueTests.test_bounded_backoff_and_dead_letter
- test_queue.QueueTests.test_concurrent_claims_have_one_owner
- test_queue.QueueTests.test_crash_budget_is_bounded
- test_queue.QueueTests.test_expired_owner_cannot_finish_without_replacement
- test_queue.QueueTests.test_identical_retry_and_conflicting_id
- test_queue.QueueTests.test_paused_endpoint_and_resume
- test_queue.QueueTests.test_permanent_rejection_does_not_retry
- test_queue.QueueTests.test_redirect_is_terminal
- test_queue.QueueTests.test_replay_keeps_event_id_and_attempt_history
- test_queue.QueueTests.test_restart_preserves_committed_event
- test_queue.QueueTests.test_retention_preserves_pending_and_rejects_expired_replay
- test_queue.QueueTests.test_signing_secret_is_absent_from_snapshot_and_audit
- test_queue.QueueTests.test_slow_endpoint_capacity_does_not_block_other_endpoint
- test_queue.QueueTests.test_worker_crash_expires_and_fences_stale_completion
- test_queue.StartupTests.test_demo_setup_and_repeat_start
Run locally
Python 3.12+ / SQLite via Python standard library
# Terminal 1: python receiver.py # Terminal 2: python app.py --demo # Open http://127.0.0.1:9080 python verify.py python demo.py python build_report.py python operations_rehearsal.py
Source and evidence
- Durable queue and signed sender
delivery_queue.py - HTTP API and worker process
app.py - Response-loss receiver fixture
receiver.py - Sample event
examples/event.json - Executed HTTP attempts
results/attempts.csv - Terminal job states
results/jobs.csv - Receiver deduplication evidence
results/receipts.json - Integration test suite
test_queue.py - Executed operations and recovery report
operations-report.html - Expected and observed operational outcomes
completion.json - Reproducible crash and recovery scenarios
operations_rehearsal.py - Checked SQLite backup and restore CLI
operations.py - Periodic snapshot runner
backup_schedule.py - Deployment, recovery and capacity assumptions
OPERATIONS.md
Limits
- Single-host SQLite service with local administrative bearer access. No enterprise identity, high availability, Postgres adapter or production TLS API listener.
- Retries use capped exponential backoff without jitter or Retry-After support. DNS timing follows the OS resolver. A crash before sending consumes an attempt.
- Seven-day terminal payload retention is implemented; job, attempt and audit metadata do not have automatic retention. Purged payloads cannot be replayed.
- The additional operations run sends 80 synthetic jobs through four workers and records 120 HTTP attempts with 80 receiver effects. It is a finite local workload, not an internet capacity or physical power-loss qualification.