Sinks¶
A pipeline has one or more sinks. With more than one sink, Courier inserts an implicit broadcast splitter — every envelope is cloned to every sink, and the splitter is synchronous per sink (a slow sink applies backpressure to the whole pipeline). See Backpressure.
The simplest sink implements WriteOne::write(&env) and is wrapped in ManagedSink, which owns the recv loop, honors the CancellationToken, and applies the configured on_error and retry policies.
Built-in sinks¶
| Kind | Description |
|---|---|
api |
Sends each envelope to an HTTP endpoint as a JSON request. |
file |
Appends each envelope to a local file in JSONL or CSV format. |
kafka |
Produces records to a Kafka topic via rdkafka. |
sql |
Inserts one row per envelope into a SQL table. |
Writing your own sink¶
Implement WriteOne for the simple case — Courier wraps it in ManagedSink and you get retry, dead-letter, and on_error for free. For sinks that batch or maintain background connections, implement the full Sink trait directly. Register a SinkFactory against a unique kind — see Development.