Skip to content

webhook feature implemented#42

Merged
MaryammAli merged 2 commits into
Proof-Stell:mainfrom
feyishola:feat/webhook
Jun 29, 2026
Merged

webhook feature implemented#42
MaryammAli merged 2 commits into
Proof-Stell:mainfrom
feyishola:feat/webhook

Conversation

@feyishola

Copy link
Copy Markdown
Contributor

closes #28

Summary of my implementation
src/webhook.rs

WebhookPayload — serializable event envelope with idempotency_key derived from tx hash + event index
DeadLetterEntry — captures failed deliveries (url, payload, attempts, last_error, failed_at)
WebhookDispatcher — contacts URLs sequentially in registration order, never skipping on failure
deliver_with_retry — exponential backoff: min(base * 2^attempt, max) + jitter(capped/4)
dispatch_background(Arc, event) — fire-and-forget via tokio::spawn
drain_dlq() / dlq_depth() — DLQ management, bounded at 10 000 entries
from_app_config — wires directly from AppConfig
src/metrics.rs

Added webhook_deliveries_total{status}, webhook_delivery_latency_seconds{status}, webhook_dlq_depth, webhook_retries_total
src/config.rs

5 new fields: webhook_max_retries (5), webhook_retry_base_delay_ms (200 ms), webhook_retry_max_delay_ms (30 s), webhook_request_timeout_ms (10 s), webhook_jitter_enabled (true)
Validation: base ≤ max delay, non-zero delays, boolean parsing
Corresponding env vars: WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_BASE_DELAY_MS, WEBHOOK_RETRY_MAX_DELAY_MS, WEBHOOK_REQUEST_TIMEOUT_MS, WEBHOOK_JITTER_ENABLED
src/lib.rs — registered pub mod webhook

src/main.rs — WebhookDispatcher in AppState, GET /webhooks/dlq, POST /webhooks/dlq/drain

README.md — added Webhook Delivery section with event payload schema, header table, retry formula, ordering/DLQ semantics, updated env-var table and metrics tables with alerting rules

@MaryammAli MaryammAli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
thanks for ur contribution

@MaryammAli MaryammAli merged commit 67b96da into Proof-Stell:main Jun 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement webhook delivery with retry and ordering guarantees

2 participants