2026-04-10 10:04:38 +02:00
|
|
|
# Redis Streams Example
|
|
|
|
|
|
|
|
|
|
This example uses Redis Streams consumer groups.
|
|
|
|
|
|
|
|
|
|
There are two scenarios. One produces messages, consumes them, acknowledges
|
|
|
|
|
them, and checks that the pending queue drains to zero. The other leaves
|
|
|
|
|
messages pending on one consumer and has a second consumer reclaim them with
|
|
|
|
|
`XAUTOCLAIM`.
|
|
|
|
|
|
|
|
|
|
This example is compose-only.
|
|
|
|
|
|
|
|
|
|
## How TF runs this
|
|
|
|
|
|
|
|
|
|
Each example follows the same pattern:
|
|
|
|
|
|
|
|
|
|
- TF starts Redis in Docker Compose
|
|
|
|
|
- a workload drives stream and consumer-group operations through the Redis client
|
|
|
|
|
- an expectation checks health and pending-message state
|
|
|
|
|
|
|
|
|
|
## Scenarios
|
|
|
|
|
|
|
|
|
|
- `compose_roundtrip` covers stream setup, production, consumer-group reads, acknowledgements, and pending drain
|
|
|
|
|
- `compose_failover` simulates pending-message reclaim after one consumer stops acknowledging
|
|
|
|
|
|
|
|
|
|
## Run with Docker Compose
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-04-12 10:55:19 +02:00
|
|
|
cargo run -p redis-streams-examples --bin redis_streams_compose_roundtrip
|
2026-04-10 10:04:38 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Run the reclaim scenario
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-04-12 10:55:19 +02:00
|
|
|
cargo run -p redis-streams-examples --bin redis_streams_compose_failover
|
2026-04-10 10:04:38 +02:00
|
|
|
```
|