Quick overview
This workflow implements an event bus in n8n that accepts event envelopes via webhook or Execute Workflow, validates and logs them to an external event store, routes events to multiple HTTP subscriber endpoints, and handles failures with exponential backoff retries, a dead-letter queue, and Slack alerts.
How it works
- Receives an event envelope either from an HTTP POST webhook or from another n8n workflow via Execute Workflow inputs.
- Validates and normalizes the envelope fields (eventType, eventId, source, timestamp, payload) and rejects invalid webhook requests with a 400 response.
- Appends every valid event to an external event store over HTTP and returns a 202 “accepted” webhook response.
- Routes the event by eventType and fans out deliveries to subscriber services via HTTP (Order Service, Notification Service, and an Analytics Service catch-all), while unknown types still flow to analytics.
- If a subscriber delivery fails, computes an exponential backoff delay and retries up to the configured maximum attempts.
- When retries are exhausted, writes the failed delivery to an external dead-letter queue over HTTP and posts an alert to a Slack channel.
- When delivery succeeds, acknowledges the event back to the event store over HTTP.
Setup
- Provide reachable HTTP endpoints for the event store append URL, event store ack URL, and dead-letter queue URL, then replace the placeholder URLs in the event bus configuration.
- Set the subscriber endpoint URLs (order, notification, analytics) in the event bus configuration to your real services that can accept the event JSON payload.
- Add a Slack credential in n8n and set the target channel name for DLQ alerts in the event bus configuration.
- If using the webhook ingress, copy the production webhook URL for
POST /event-bus/publish and configure your event producers to send the event envelope to it.
- If publishing from other n8n workflows, call this workflow via Execute Workflow and pass at least eventType and payload (and optionally eventId, source, and timestamp).