Expand description
Redis / Valkey broker implementation for RustStream, backed by fred.
This crate implements the RustStream broker contract over Redis Streams: durable consumer
groups with acknowledgement, redelivery, and crash recovery. Subjects are stream keys; a
subscription reads through a consumer group, either off the fresh tail
(RedisStream::new) or reclaiming another consumer’s stale pending entries
(RedisStream::reclaim).
Settlement follows the republish-retry model: ack is XACK, nack(requeue = true) re-appends
a copy to the same stream then acks the original, and nack(requeue = false) acks to drop.
The lifecycle is the framework’s ladder of consuming transitions: RedisBroker records the
topology synchronously, Broker::connect yields the
ConnectedRedisBroker that every subscription and publisher is reached from, and
ConnectedBroker::shutdown yields the terminal
ClosedRedisBroker. Publishers are declared as a policy (RedisPublish,
RedisPubSubPublish, RedisListPublish) that pairs with the connected form.
Modules§
- context
- Optional typed per-delivery context exposing native Redis metadata by compile-time key. Optional typed per-delivery context exposing native Redis metadata, one struct per transport.
- testing
- In-process Redis test transport used by application unit tests and the conformance suite.
Structs§
- Closed
Redis Broker - The terminal witness returned by shutting down a
ConnectedRedisBroker. - Connected
Redis Broker - The typed witness that
Broker::connectsucceeded: it owns the livefredpool. - EntryId
- A Redis Streams entry id: the
<milliseconds>-<sequence>pair the server assigns to every entry. - Redis
Broker - An unconnected Redis broker: the recorded topology and its options, no I/O performed yet.
- Redis
Group Seeker - Moves a consumer group’s cursor.
- Redis
List - Describes one list subscription against a
ConnectedRedisBroker. - Redis
List Message - A list-queue delivery. In simple mode
ack/nackare unsupported; in reliable modeackremoves the entry from the processing list andnackeither returns it or drops it. - Redis
List Publish - The declaration half of the list publisher: envelope codec and key TTL, no connection.
- Redis
List Publisher - Publishes onto a list with
LPUSH, so right-popping consumers see FIFO order: aRedisListPublishpolicy paired with a connection. - Redis
List Subscriber - A list-backed work-queue subscription.
- Redis
Message - A Redis Streams delivery, read from a consumer group via
XREADGROUPorXAUTOCLAIM. - Redis
PubSub - Describes one Pub/Sub subscription against a
ConnectedRedisBroker. - Redis
PubSub Message - A Pub/Sub delivery.
ack/nackare unsupported (Pub/Sub has no acknowledgement). - Redis
PubSub Publish - The declaration half of the Pub/Sub publisher: delivery mode and envelope codec, no connection.
- Redis
PubSub Publisher - Publishes Pub/Sub messages with
PUBLISH(classic) orSPUBLISH(sharded): aRedisPubSubPublishpolicy paired with a connection. - Redis
PubSub Subscriber - A Pub/Sub subscription backed by a dedicated
fredclient, so its message stream and channel state are isolated from other subscribers and from the publishing pool. - Redis
Publish - The declaration half of the stream publisher: pure policy, constructible anywhere.
- Redis
Publisher - The live stream publisher:
RedisPublishpaired with a connection. Cheap to clone. - Redis
Stream - Describes one Redis Streams subscription against a
ConnectedRedisBroker. - Redis
Subscriber - A Redis Streams subscription bound to a consumer group.
- Redis
Transaction - An owned Redis transaction, opened by
transactionon aRedisPublisher. - TlsConfig
- TLS configuration for a client.
Enums§
- Delayed
Retry - How a subscription should handle
retry_after/nack_afterdelays. - PubSub
Mode - Pub/Sub delivery mode. Defaults to
Classic. - Redis
Error - Errors surfaced by the Redis broker implementation.
- Redis
Group Position - Where a consumer group’s cursor sits, for
RedisGroupSeeker::seekand thestart_at(..)clause of#[subscriber]. - Stream
Start - Where a freshly created consumer group starts reading from. Only consulted when the group does not yet exist; an existing group keeps its own cursor.
- TlsConnector
- An enum for interacting with various TLS libraries and interfaces.
Constants§
- DEAD_
LETTER_ REASON_ HEADER - Header naming why a message was dead-lettered: [
REASON_DROPPED] or [REASON_MAX_DELIVERIES]. - DELIVERY_
COUNT_ HEADER - Header exposing the native Redis Streams delivery count on a reclaimed delivery, so a handler can branch or dead-letter manually.
- IDLE_
MS_ HEADER - Header exposing how long (milliseconds) a reclaimed delivery had been pending.
- PARTITION_
KEY_ HEADER - The well-known header key for per-message routing / partitioning.
Traits§
- Credential
Provider - A trait that can be used to override the credentials used in each
AUTHorHELLOcommand.