Skip to main content

Webhook fan-out: one event, many destinations

One thing happens in your workspace — a message is delivered, a call completes, a flow step fires — and Orbit emits one event for it. From that point the event fans out to zero or more destinations: the ephemeral events buffer, every registered webhook endpoint, and any configured event sink. Each destination is an independent subscription with its own routing filter, its own retry state, and its own dead-letter path. This page explains that topology — what the producer surfaces are, how a subscription declares what it wants, and what failure means per destination. The transport contract for any single webhook endpoint (payload envelope, retry schedule, DLQ, proven-dead statuses) is covered in Webhook delivery semantics; this page is the model one level up.

Section 1 — Producer vs. consumer surfaces

Orbit emits platform events from one taxonomy — message.*, call.*, flow.*, and the rest of the catalog on the events reference. Every event carries the same envelope (id, type, created_at, data), and three surface groups consume it:
  • Events buffer (ephemeral). Events API — a bounded replay window (the most recent ~5000 events per tenant, expiring after ~15 minutes of inactivity) that you poll over REST or stream over SSE. It is for live dashboards and “what just happened” debugging; evicted ids are gone. Never treat it as delivery.
  • Webhooks (durable, retried, signed). Each endpoint you register (webhooks overview) is a push destination. Orbit delivers the event to it at least once, signs the request, retries on a bounded schedule, and dead-letters after the schedule exhausts.
  • Event sinks (to your own infrastructure). A sink (Event Sinks API) points the same event stream at your own Kafka topic or batch HTTP collector instead of an HTTP receiver per event type. You get one destination carrying many event types; record shaping is byte-identical to the webhook envelope either way. Delivery is live: every event that matches the sink’s filter is produced to your Kafka topic, or buffered and POSTed to your collector as a JSON array, with per-sink retries, a dead-letter list, and a run status you can read back. The mechanics are in How sink delivery works below.
The distinction that matters operationally: webhooks and event sinks are the durable consumer surfaces. The events buffer is a convenience — build nothing on it that has a retention requirement.

Section 2 — The fan-out topology

One event becomes zero or many deliveries. Orbit does not “route” an event to a single destination; it fans the event out to every subscription whose filter matches:
A subscription is just the pair (filter, destination). Orbit keeps per-subscription delivery state: consecutive-failure counts, the retry position for each in-flight delivery, and the DLQ. No state is shared across subscriptions — endpoint A having a bad day does not slow, block, or starve endpoint B, and a sink that starts returning errors does not change the retry schedule of any webhook endpoint. If no subscription matches an event’s type, the event still lands on the events buffer and nowhere else — there is nothing to deliver.

Section 3 — Routing filters: how a subscription declares what it wants

The customer-facing filter is an events array on the registration:
  • Webhook endpoint — events: ["message.*"], events: ["message.delivered", "call.completed"], or events: ["*"] for everything (see webhooks overview).
  • Event sink — the events field at PATCH /api/v1/developer/event-sinks/{kind} accepts the same vocabulary: an exact type (message.sent), a <prefix>.* glob (message.*), or * (see Event Sinks API). An empty or * filter means every event.
The same filter vocabulary applies on both surfaces — name the prefix you want, or subscribe to all. Orbit evaluates the filter per event at fan-out time, and a subscription never sees a non-matching event type. (event id) is duplicated across subscriptions — every receiver deduplicates independently on the envelope id (evt_...), not just its own (see delivery semantics).

Section 4 — Ordering and at-least-once semantics

There is no global ordering guarantee across subscriptions — and there cannot be, because each surface has its own transport. “Event E1 then E2” holds per subscription, not across them:
  • Webhook endpoints receive E1 before E2 (Orbit emits in event-time per endpoint), but network reordering can still invert them — see the ordering section of delivery semantics.
  • A Kafka sink gets partition-level ordering only within one key: every event whose partition_key_path (such as data.contact_id) resolves to the same value lands on the same partition and stays in order there. Different keys share no ordering.
  • An http_batch sink keeps buffer order inside one flush — one POST carries its events in the order they were buffered — but makes no promise across flushes.
  • The events buffer shows insertion order within the retained window.
Every delivery is at-least-once: a timed-out attempt that actually landed, and any DLQ replay, are legitimate re-deliveries of the same event. Corollary: the same id may arrive at the same endpoint more than once, and will arrive at different endpoints on independent schedules. Write each receiver idempotently — dedupe on the envelope id, and let the event with the largest created_at win for entity state.

Section 5 — Failure modes

Because fan-out is per-subscription, failure is too. The table is the whole model: Two safety properties follow. Replay is safe by construction: a DLQ requeue re-enters the retry pipeline as a fresh attempt, which is exactly why the dedup window (the evt_... buffer, held for at least 7 days) must span the replay window, not just the initial retries. And signature verification gates the receiver: a failed HMAC check drops the delivery before your handler runs, so spoofed payloads never enter your dedup set — see troubleshooting signature failures. For event sinks the same philosophy applies, with the retry and health state living on the sink itself rather than on a per-endpoint delivery schedule: each sink retries with backoff, dead-letters what it cannot land, and reports its own run status — and none of that touches your webhook endpoints. The full mechanics are below.

How sink delivery works

Sinks are a live delivery surface, not a stored-only config. This section is the transport model the rest of the page assumes.

Source of the stream

Sink delivery rides the same fan-out that drives webhooks: every platform event in the catalog your webhook endpoints subscribe to — the same taxonomy as the events reference, in the same envelope (id, type, created_at, data) — is eligible for your sinks. The sink subscriber matches each event against each sink’s events filter and produces a record that is byte-identical to the webhook envelope — one parser serves every receiver you run. If your filter excludes an event type, the sink never sees it; if no sink is enabled, nothing is produced.

Kafka path

A matching event is one produce onto your topic. The message key is the partition key derived from your partition_key_path (for example data.contact_id); when you do not set one, Orbit picks the first non-empty of contact_id, conversation_id, message_id, call_id, to, then the event id. All events that resolve to the same key land on the same partition and stay ordered there — that is the ordering guarantee, and it is per key, never global. Each record carries a content-type: application/json header plus your configured static headers and an x-orbit-event-type header for cheap consumer-side routing. Broker connections are pooled and shared with Orbit’s CDP streaming pipeline; your SASL credential is decrypted only at produce time.

HTTP batch path

A matching event is buffered per tenant and flushed to your collector as a single POST whose body is a JSON array of envelopes. A flush happens when the buffer reaches your max_batch_size (upper bound 1000) or after a bounded flush interval of a few seconds, whichever comes first — so a low-volume sink still sees bounded delivery latency instead of waiting for a full batch. Your configured static headers ride on the POST, and a stored bearer token, if any, is sent as an Authorization header. Each flush is one HTTP exchange: either the whole array lands or the whole array is retried.

Failure model

Both paths retry a failed produce or POST with exponential backoff — three attempts, backoff doubling from 200 ms and capped at 5 s. What still fails after the last attempt is set aside rather than silently dropped: one dead-letter entry per event (a failed batch dead-letters each event in it separately) on a bounded list per tenant and sink kind that keeps the newest 1,000 entries and evicts the oldest first. Each dead-letter entry is self-contained — envelope, sink kind, attempt count, error, timestamp — so you can replay or inspect it. Isolation is fail-soft at two levels. One tenant’s broken sink never stalls the shared subscriber or another tenant’s delivery, and a sink that stays down simply fills its bounded dead-letter list without unbounded growth. Sink failure is also independent of webhook failure by construction: webhook endpoints keep their own schedule (1 initial attempt plus 9 retries over roughly 4.3 hours, then a 7-day replayable DLQ, per delivery semantics); a sink keeps a short produce/POST retry loop plus its dead-letter list. The two surfaces share nothing but the event. Ordering under failure follows the same rule as above: Kafka order holds per key, http_batch order holds within one flush, and neither is global. Delivery remains at-least-once — a batch that eventually succeeds after a retry, or a dead-lettered event you replay, is a legitimate re-delivery — so dedupe downstream on the envelope id exactly as you do for webhooks.

Run status and health read-back

Every delivery outcome is written back onto the sink’s config as run-status fields: last_run_at, last_run_status (ok or failed), last_produced_count (a successful batch credits every event in it), last_error, last_error_at, and consecutive_failures (reset to 0 on the next success). GET /api/v1/developer/event-sinks/{kind} returns them alongside your config, and the dashboard reads the same fields — so “is my sink healthy” is a read, not a guess: consecutive_failures climbing while last_error names the collector or broker fault tells you the sink is down before your downstream pipeline feels it. The fields are worker-owned: PATCH never accepts them, so a config update cannot forge a healthy status.

Security posture

As configured and delivered, the surface stays inside the controls you already hold:
  • Roles. Only owner, admin, and developer can read or change a sink.
  • Credentials. The Kafka SASL password or HTTP bearer token is encrypted at rest and is never returned — reads surface credentials_configured instead. Patch credentials: "" to clear it.
  • Destinations. An http_batch collector URL must be HTTPS and resolve to a public host; private and metadata addresses are rejected at PATCH time, before the worker can ever POST to it. Kafka brokers are validated as host:port.
  • Audit. Every config change emits a developer.event_sink_updated audit event carrying the sink kind and the changed field names, never values.

Section 6 — Where to watch delivery health

Three operational surfaces, one per class of question:
  • One specific delivery — Inspecting deliveries shows every delivery attempt per endpoint and the response it got, and the DLQ surfaces (Developer → Webhooks → Dead-letter queue in the dashboard, or GET /api/v1/webhooks/dlq) hold the terminal failures.
  • A signature that fails on your side — Troubleshooting signature failures covers rotation windows and verification gotchas.
  • A sink that is unhealthy — read its run status (last_run_status, last_error, consecutive_failures) via GET /api/v1/developer/event-sinks/{kind}; the same fields are the ones the dashboard shows. The write-back mechanics are in How sink delivery works.
Alerting on webhook health is on you: the operator-observability map puts it on the short list of places to hook thresholds — its durable-feed discussion is also where the trade-off between webhooks and the ephemeral events buffer is framed in full.

Where this fits

This page is the one level up from the transport contract — the sibling pages carry the details: