Skip to main content

Module sink

Module sink 

Source
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

AdapterNotes
MemorySinkAdapterIn-memory; for tests and rapid prototyping
StdoutSinkWrites NDJSON to stdout; for local debugging and Docker deployments
FileJsonlSinkAppends NDJSON to a file with async I/O, batching, and rotation
FanOutSinkAdapterDelivers each event to every child sink concurrently
BoxedSinkType-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§

AdapterConformanceSuite
Convenience harness that runs all base adapter conformance scenarios against a single SinkAdapter + AdapterGoldenFixture pair.
AdapterGoldenFixture
A set of events used as input for a single conformance scenario.
BasicAdapterConformance
Default conformance validator for SinkAdapter implementations.
BoxedSink
A heap-allocated, type-erased SinkAdapter for dynamic dispatch.
MemorySinkAdapter
In-memory sink adapter for testing and rapid prototyping.
SinkDeliveryMetrics
A snapshot of delivery counters exposed by a SinkAdapter for observability.
TestResult
Result of a single conformance scenario.

Enums§

SinkDeliveryGuarantee
The delivery guarantee an adapter can offer to the pipeline.

Traits§

SinkAdapter
Trait for sending CDC events to a downstream system.