Skip to content

Redis broker

ruststream-fred is the Redis broker for the RustStream framework. It is built on Redis Streams: every subscription reads through a consumer group, so deliveries are durable and acknowledged. It also ships an in-memory test broker under its testing feature.

ruststream = { version = "0.5", features = ["macros"] }
ruststream-fred = "0.5"
serde = { version = "1", features = ["derive"] }

RedisBroker::standalone is synchronous and does no I/O, so a Redis service is assembled with the same #[ruststream::app] macro as any other broker. The runtime connects the broker once at startup, before opening subscriptions.

Scaffold a service

Generate a runnable starter with cargo generate, one template per transport:

cargo generate --git https://github.com/powersemmi/ruststream-fred templates/redis-stream
cargo generate --git https://github.com/powersemmi/ruststream-fred templates/redis-pubsub
cargo generate --git https://github.com/powersemmi/ruststream-fred templates/redis-list

Topologies

One crate, three named constructors. Each is synchronous and connects lazily:

# standalone
# RedisBroker::standalone("redis://localhost:6379")
# cluster (one reachable seed node is enough; the rest is discovered)
# RedisBroker::cluster(["127.0.0.1:7000", "127.0.0.1:7001"])
# sentinel (the monitored primary's name plus the sentinels)
# RedisBroker::sentinel("mymaster", ["127.0.0.1:26379"])

Transport guides