ruststream-fred connects a RustStream service to Redis and Valkey over
fred. Handlers, routing, codecs and middleware come from the
framework; this crate is the transport.
Features
- Redis Streams with consumer groups, including reclaiming a crashed consumer's pending entries.
- Lists and Pub/Sub beside them: a list as a work queue, at-most-once or reliable, and Pub/Sub fan-out, classic, sharded or by pattern.
- Settlement that follows the transport:
XACKon a stream, a processing list for a reliable list, andAckError::Unsupportedwhere Redis has nothing to settle. - Retry caps and dead letters declared where the handler is mounted, on every transport.
- Batches on every transport, read with one
XREADGROUPon a stream. - Pipelining on every form:
.pipeline()sends a fetch's settles and the handler's own commands in one round trip, and.atomic()makes them oneMULTI/EXEC. - Standalone, cluster and sentinel, with authentication and TLS on each.
- Transactions as one
MULTI/EXECblock, and repositioning a consumer group withstart_at(..). - Tests on the production app without a server:
TestAppruns the service's own app with itsRedisBrokerconnected to an in-process Redis.
Install
[]
= { = "0.7", = ["macros", "json"] }
= "0.7"
= { = "1", = ["derive"] }
[]
= { = "0.7", = ["testing"] }
Optional features: TLS (tls-rustls, tls-rustls-ring, tls-native-tls), sentinel-auth and
credential-provider.
Write a service
use *;
use ;
async
#[ruststream::app] generates main, so the binary understands run and asyncapi gen.
Scaffold a fresh project from a template, one per transport:
Test it
TestApp runs the service's own app with RedisBroker in process, with no server.
use TestApp;
let tb = start.await?;
tb.
.message
.to
.publish
.await?;
tb.
.subscriber
.assert_called_once
.settled;
tb.
.
.assert_called_once;
Documentation
- This crate: https://docs.rs/ruststream-fred
- The framework: https://powersemmi.github.io/ruststream/latest
Minimum supported Rust version
The MSRV is 1.95, edition 2024.
Contributing
See CONTRIBUTING.md.
License
Licensed under the Apache-2.0 license.