Skip to main content

ruststream_kinesis/
lib.rs

1//! Amazon Kinesis Data Streams broker implementation for `RustStream`.
2//!
3//! Handlers, routers, codecs, and middleware come from the framework; this crate supplies
4//! the transport over the official [`aws-sdk-kinesis`](https://docs.rs/aws-sdk-kinesis) -
5//! plus the coordination the vendor's consumer library provides on other platforms and the
6//! Rust SDK does not: shard discovery across splits and merges, shard leasing with fencing,
7//! and per-shard checkpointing.
8//!
9//! - Acknowledgement is a checkpoint: `ack` marks a record handled, and the per-shard
10//!   watermark advances (and persists) once every earlier record is handled too - a
11//!   checkpoint implies everything before it. An unacknowledged record wedges the watermark,
12//!   so the shard replays from it when the lease is next taken: at-least-once, always.
13//! - Leases live in a pluggable [`LeaseStore`]: the built-in in-process store is correct for
14//!   a single service instance; the `DynamoDB` store behind the `dynamodb-lease` feature lets
15//!   multiple instances share the shards with conditional-write fencing.
16//! - Children of a split or merge start only after their parents are fully consumed, which
17//!   is what keeps per-key ordering across resharding.
18//! - Where a subscription starts is one vocabulary, not two: a shard resumes from its stored
19//!   checkpoint and otherwise opens at the tip, and [`KinesisPosition`] repositions it -
20//!   through the framework's `start_at(..)` clause at startup, or the `Seekable` capability
21//!   while it runs.
22//! - Shared polling only in this release: enhanced fan-out is a different resume machine on
23//!   an HTTP/2 push stream with no local emulator support, and is deliberately deferred.
24//!   KPL-aggregated records are refused loudly rather than delivered as opaque protobuf.
25
26#![forbid(unsafe_code)]
27
28mod broker;
29#[cfg(feature = "dynamodb-lease")]
30mod dynamo;
31mod error;
32mod lease;
33mod message;
34mod publisher;
35mod stream;
36mod subscriber;
37#[cfg(feature = "testing")]
38pub mod testing;
39mod track;
40
41pub use broker::{ConnectedKinesisBroker, KinesisBroker};
42#[cfg(feature = "dynamodb-lease")]
43pub use dynamo::DynamoLeaseStore;
44pub use error::KinesisError;
45pub use lease::{LeaseError, LeaseState, LeaseStore, MemoryLeaseStore, SHARD_END};
46pub use message::{
47    KinesisMessage, KinesisPosition, PARTITION_KEY_HEADER, SEQUENCE_HEADER, SHARD_HEADER,
48};
49pub use publisher::{KinesisPublish, KinesisPublisher};
50pub use stream::KinesisStream;
51pub use subscriber::{KinesisSeeker, KinesisSubscriber};