Skip to main content

Module webhook

Module webhook 

Source
Expand description

Asynchronous webhook notification system with bounded queue.

Responsibilities:

  • Enqueue webhook events to a background worker (non-blocking).
  • Background worker handles HTTP delivery with retries.
  • Bounded queue with configurable backpressure policy.
  • Generate HMAC-SHA256 signatures for webhook verification.
  • Expose delivery diagnostics and bounded replay controls for failed events.

Does NOT handle:

  • Webhook endpoint management or registration.
  • UI mode detection (callers should suppress if desired).
  • Response processing beyond HTTP status check.
  • Exactly-once delivery guarantees.

Invariants:

  • Webhook failures are logged but never fail the calling operation.
  • Secrets are never logged or exposed in error messages.
  • All requests include a timeout to prevent hanging.
  • Queue backpressure protects interactive UX from slow endpoints.
  • Worker thread is automatically cleaned up on drop.

Re-exports§

pub use crate::contracts::WebhookQueuePolicy;

Structs§

ReplayCandidate
ReplayReport
ReplaySelector
ResolvedWebhookConfig
Resolved webhook configuration with defaults applied.
WebhookContext
Optional context metadata for webhook payloads. These fields are only serialized when set (Some).
WebhookDiagnostics
WebhookFailureRecord
WebhookPayload
Webhook event payload structure.

Enums§

WebhookEventType
Types of webhook events that can be sent.

Functions§

diagnostics_snapshot
failure_store_path
init_worker_for_parallel
Initialize the webhook dispatcher with capacity scaled for parallel execution.
notify_loop_started
Convenience function to send loop started webhook. This is a loop-level event with no task association.
notify_loop_stopped
Convenience function to send loop stopped webhook. This is a loop-level event with no task association.
notify_phase_completed
Convenience function to send phase completed webhook.
notify_phase_started
Convenience function to send phase started webhook.
notify_queue_unblocked
Convenience function to send queue unblocked webhook. This is a loop-level event with no task association.
notify_status_changed
Convenience function to send generic status change webhook.
notify_task_completed
Convenience function to send task completed webhook.
notify_task_completed_with_context
Convenience function to send task completed webhook with context.
notify_task_created
Convenience function to send task creation webhook.
notify_task_created_with_context
Convenience function to send task creation webhook with context.
notify_task_failed
Convenience function to send task failed/rejected webhook.
notify_task_failed_with_context
Convenience function to send task failed webhook with context.
notify_task_started
Convenience function to send task started webhook.
notify_task_started_with_context
Convenience function to send task started webhook with context.
replay_failed_deliveries
send_webhook
Send a webhook notification (non-blocking, enqueues for delivery).
send_webhook_payload
Send a webhook payload directly (non-blocking, enqueues for delivery).