Database / REDIS
How does Redis Streams support consumer groups?
A consumer group lets multiple consumers cooperatively process a single stream, with Redis tracking, per group, which entries have been delivered and which have been explicitly acknowledged — behavior much closer to a traditional message queue than Redis's other data types offer.
XGROUP CREATE events mygroup 0 XREADGROUP GROUP mygroup consumer-1 COUNT 10 STREAMS events > XACK events mygroup 1691425200000-0
When a consumer reads with XREADGROUP, entries are added to that consumer's pending entries list (PEL) — delivered but not yet acknowledged. Calling XACK removes an entry from the PEL once processing is confirmed complete. If a consumer crashes with unacknowledged entries still in its PEL, XCLAIM (or the newer XAUTOCLAIM) lets another consumer in the same group take ownership of those stuck entries and retry them, which is what gives Streams at-least-once delivery semantics within a group — an entry isn't considered fully processed until it's explicitly acknowledged, no matter which consumer ends up handling it.
More Related questions...
