Web hook event - #136
Merged
Merged
Conversation
Contributor
Author
|
@memplethee-lab pr sent please review |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Webhooks & Reliable Event Delivery Module — Implementation Complete
Files Created (10 new)
Entities (
src/infrastructure/webhooks/entities/)webhook-subscription.entity.ts— Per-subscriber config: URL, signing key (whsec_), events, retry/backoff params, rate limits, custom headerswebhook-event.entity.ts— Event payload with type, aggregate ID, delivery/success/failure counterswebhook-delivery.entity.ts— Individual delivery attempts: status tracking, request/response headers, retry schedulingwebhook-dead-letter.entity.ts— Permanently failed deliveries with full attempt history for debuggingServices (
src/infrastructure/webhooks/services/)webhook-hmac.service.ts— HMAC-SHA256 signing withtimingSafeEqualverificationwebhook-subscription.service.ts— CRUD, signing key generation (whsec_<32-byte-hex>), key rotation, wildcard event matchingwebhook-delivery.service.ts— HTTP delivery with HMAC headers, exponential backoff + jitter (capped at 5 min), dead-lettering, DLQ retry, aggregated metricswebhook-event.service.ts— Event publishing, subscriber matching, Bull queue enqueue, event replaywebhook-processor.service.ts— Bull@Processor("webhook-delivery")for async executionController + Module
webhook.controller.ts— Full REST API under/webhookswith Swagger decoratorswebhook.module.ts— Wires TypeORM entities, Bull queue, HttpModuleFiles Modified (2)
src/app.module.ts— AddedWebhookModuleimport, 4 entity registrationssrc/config/env.validation.ts— AddedWEBHOOK_*env vars +REDIS_HOST/REDIS_PORT/REDIS_PASSWORDAPI Endpoints
Key Design Decisions
- HMAC-SHA256 per-subscriber signing with
- Exponential backoff with 20% jitter, capped at 5 minutes
- Dead-letter queue after max retries, with manual retry capability
- Event replay for re-triggering historical events
- Bull queue (
- Wildcard subscriptions via
closes #128X-Webhook-Signatureheader (GitHub-style)webhook-delivery) for async processing, consistent with existing email queue patternevents: ["*"]