Expand description
Redis Pub/Sub transport: fire-and-forget fan-out with no acknowledgement.
Unlike Streams, Pub/Sub has no durability, no consumer groups, and no ack: a message reaches
whichever subscribers are connected at publish time, and ack / nack report
AckError::Unsupported. Two delivery modes exist, explicit because they do not interoperate:
PubSubMode::Classic-SUBSCRIBE/PUBLISH, broadcast to every node; supports patterns (PSUBSCRIBE). The only option on standalone and sentinel.PubSubMode::Sharded-SSUBSCRIBE/SPUBLISH(Redis 7+), slot-local so it scales across a cluster, but has no pattern support.
A channel and a pattern are two descriptors, RedisPubSub and RedisPubSubPattern,
because they differ in more than a flag: a pattern reads many channels and names none, so
sharded delivery has no meaning there and neither does a destination a retry copy could go to.
Headers travel in a frame around the payload: a binary frame by default, or a readable
codec-serialized envelope when a codec is set with RedisPubSub::codec /
RedisPubSubPublish::codec. Both framings are lossless; the envelope writes a field whose
bytes are valid UTF-8 as text and any other bytes as themselves.
Re-exports§
pub use crate::pubsub::RedisPubSubPublish as Publish;
Modules§
- prelude
- The core prelude plus everything a Redis Pub/Sub service writes.
Structs§
- Redis
PubSub - Describes one Pub/Sub subscription on a single channel, against a
ConnectedRedisBroker. - Redis
PubSub Message - A Pub/Sub delivery.
ack/nackare unsupported (Pub/Sub has no acknowledgement). - Redis
PubSub Pattern - Describes one Pub/Sub subscription on a glob pattern (
PSUBSCRIBE), against aConnectedRedisBroker. - 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.
Enums§
- PubSub
Mode - Pub/Sub delivery mode. Defaults to
Classic.