Expand description
Sink adapter trait and built-in implementations.
The SinkAdapter trait is the primary integration point for embedders that
want to connect the CDC runtime output to a downstream system (Kafka, database,
HTTP endpoint, etc.). Implement SinkAdapter on your own type and pass it to
the runtime’s event processing loop.
§Built-in adapters
| Adapter | Notes |
|---|---|
MemorySinkAdapter | In-memory; for tests and rapid prototyping |
StdoutSink | Writes NDJSON to stdout; for local debugging and Docker deployments |
FileJsonlSink | Appends NDJSON to a file with async I/O, batching, and rotation |
FanOutSinkAdapter | Delivers each event to every child sink concurrently |
BoxedSink | Type-erased heap-allocated adapter for dynamic dispatch |
§Delivery contract
Every SinkAdapter implementation advertises its delivery guarantee via
SinkAdapter::delivery_guarantee. Adapters that support transactional
checkpoint barriers should also override
transactional_checkpoint_barrier_capable
and the three barrier methods.
§Dynamic dispatch
SinkAdapter is not object-safe (it uses RPITIT). Use BoxedSink for
Box<dyn …> style dispatch and FanOutSinkAdapter to fan out to a
heterogeneous set of sinks.
§Conformance testing
AdapterConformanceSuite verifies that a custom SinkAdapter implementation
honours the contract (ordering, flush semantics, post-close error behaviour).
Re-exports§
pub use fan_out::FanOutSinkAdapter;pub use file_jsonl::FileJsonlSink;pub use file_jsonl::FileJsonlSinkConfig;pub use stdout::StdoutSink;
Modules§
- fan_out
FanOutSinkAdapter— delivers each event to every child sink concurrently.- file_
jsonl FileJsonlSink— append-only NDJSON file sink with async I/O, in-memory batching, size-based rotation, and configurable fsync cadence.- stdout
StdoutSink— writes newline-delimited JSON to stdout.
Structs§
- Adapter
Conformance Suite - Convenience harness that runs all base adapter conformance scenarios against a
single
SinkAdapter+AdapterGoldenFixturepair. - Adapter
Golden Fixture - A set of events used as input for a single conformance scenario.
- Basic
Adapter Conformance - Default conformance validator for
SinkAdapterimplementations. - Boxed
Sink - A heap-allocated, type-erased
SinkAdapterfor dynamic dispatch. - Memory
Sink Adapter - In-memory sink adapter for testing and rapid prototyping.
- Sink
Delivery Metrics - A snapshot of delivery counters exposed by a
SinkAdapterfor observability. - Test
Result - Result of a single conformance scenario.
Enums§
- Sink
Delivery Guarantee - The delivery guarantee an adapter can offer to the pipeline.
Traits§
- Sink
Adapter - Trait for sending CDC events to a downstream system.