XGROUP to manage the consumer groups of a stream.
CREATE registers a group and sets the position it starts reading from: 0 replays the whole stream from the beginning, while $ delivers only entries added after the group was created. MKSTREAM creates the stream too when it does not exist yet, which avoids an error on a group created before the first producer runs. SETID moves that position afterwards, which is how a group is rewound for a replay or fast-forwarded past a backlog.
CREATECONSUMER and DELCONSUMER add and remove consumers explicitly; consumers are otherwise created on first read. Deleting a consumer returns how many pending entries went away with it, and those entries are then no longer pending for anyone, so hand them over with XCLAIM or XAUTOCLAIM first if the work still matters.
DESTROY removes a group along with all of its pending state, while leaving the stream and its entries untouched.
Syntax
Arguments
Response
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples
TCP examples use the TLSREDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Redis CLI
Redis CLI
@upstash/redis
@upstash/redis
upstash_redis
upstash_redis
ioredis
ioredis
node-redis
node-redis
redis-py
redis-py
go-redis
go-redis
jedis
jedis
redis-rs
redis-rs