Skip to content

Multi-Pod Deployment

Producers

No coordination needed. XADD is atomic; Redis assigns unique IDs ({timestamp}-{seq}). All pods write to the same stream key safely.

Consumers

Each pod gets a unique worker_name. Redis distributes messages across consumers in the same group — each message delivered to exactly one pod.

Pod A: worker_name = "order_workers_pod-a_3821" ─┐
Pod B: worker_name = "order_workers_pod-b_9174" ─┼─ group "order_workers"
Pod C: worker_name = "order_workers_pod-c_0042" ─┘

Crash Recovery

If a pod crashes, its unacknowledged PEL messages go idle. Other pods reclaim them via XAUTOCLAIM after min_idle_claim_ms. Set this to at least 2× your maximum handler latency to avoid premature cross-pod reclaim.

NOGROUP Auto-Recovery

If the stream or group is deleted externally (e.g. FLUSHALL, XGROUP DESTROY), the consumer detects the NOGROUP error, clears its entry from the group registry, and re-creates the group on the next iteration — no manual restart required.

Setting Value Reason
worker_name auto (default) Unique per pod
min_idle_claim_ms 2× max handler latency Avoid premature cross-pod reclaim
block_ms 5000 Balanced latency vs idle CPU
max_deliveries 3–5 Accounts for transient failures across restarts
config = ConsumerConfig(
    group="order_workers",
    # worker_name auto-generated: "{group}_{hostname}_{rand4}"
    min_idle_claim_ms=30_000,   # if handler can take up to 15s
    block_ms=5_000,
    max_deliveries=5,
)