How nikola-golijanin/webhooks works
This repository implements an event-driven webhook service: clients register subscriptions or publish events through the API; the processing worker finds matching subscriptions, fans out delivery messages, sends HTTP POSTs to subscriber URLs, and records outcomes. The example Orders API also triggers an order-created event, and a test listener can receive and inspect deliveries. The README documents OpenTelemetry instrumentation across both services. Worker and dispatcher details are represented at their exact tree paths; their source was not sampled, so links follow the README’s described message flow.
Main entry points: WebhookDispatchedConsumer.cs Match Subscriptions · WebhookTriggeredConsumer.cs Send Delivery · WebhookDispatcher.cs Event Dispatcher · WebhooksDbContext.cs Worker Data Context
Components 22
API and Orders
- REST API
Webhooks.API/Program.cs - Webhook Endpoints
Webhooks.API/Controllers/WebhooksController.cs - Orders API
Webhooks.API/Controllers/OrdersController.cs - Order Repository
Webhooks.API/Repositories/InMemoryOrderRepository.cs - Event Dispatcher
Webhooks.API/Services/WebhookDispatcher.cs - API Data Context
Webhooks.API/Data/WebhooksDbContext.cs
Webhook Processing
- Processing Worker
Webhooks.Processing/Program.cs - Match Subscriptions
Webhooks.Processing/Services/WebhookDispatchedConsumer.cs - Worker Data Context
Webhooks.Processing/Data/WebhooksDbContext.cs - Send Delivery
Webhooks.Processing/Services/WebhookTriggeredConsumer.cs - Delivery Payload
Webhooks.Processing/Services/WebhookPayload.cs
Message Contracts
- Message Contracts
Webhooks.Contracts/WebhookDispatched.cs - Delivery Contract
Webhooks.Contracts/WebhookTriggered.cs
Observability
- API Telemetry
Webhooks.API/Program.cs - Worker Telemetry
Webhooks.Processing/Program.cs
Other components
- API Client
- PostgreSQL
- Subscriber URL
- Test Listener
Webhooks.TestListener/Program.cs - Received Webhooks
Webhooks.TestListener/WebhookStore.cs - RabbitMQ
- OTLP Backend
Connections 23
- API Client → Webhook Endpoints: manages and publishes
- API Client → Orders API: creates orders
- Webhook Endpoints → API Data Context: reads and writes
- API Data Context → PostgreSQL: persists subscriptions
- Webhook Endpoints → Event Dispatcher: dispatches event
- Orders API → Order Repository: stores order
- Orders API → Event Dispatcher: dispatches event
- Event Dispatcher → Message Contracts: creates message
- Event Dispatcher → RabbitMQ: publishes
- RabbitMQ → Match Subscriptions: delivers message
- Match Subscriptions → Worker Data Context: queries matches
- Worker Data Context → PostgreSQL: reads subscriptions
- Match Subscriptions → Delivery Contract: creates per match
- Match Subscriptions → RabbitMQ: publishes
- RabbitMQ → Send Delivery: delivers message
- Send Delivery → Delivery Payload: builds payload
- Send Delivery → Subscriber URL: posts payload
- Subscriber URL → Test Listener: example receiver
- Test Listener → Received Webhooks: stores received
- Send Delivery → Worker Data Context: records attempt
- Worker Data Context → PostgreSQL: writes attempt
- API Telemetry → OTLP Backend: exports telemetry
- Worker Telemetry → OTLP Backend: exports telemetry