Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

XPENDING

Last updated
XPENDING key group
XPENDING key group [IDLE min-idle-time] start end count [consumer]
Group
Stream
Complexity
O(N) for the entries returned (summary form O(C), C being the consumers)
Arity
-3 (at least 3 words, counting the command name)
Flags
read-only
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

XPENDING shows the pending entries list (PEL) of the consumer group group on the stream key: entries that were delivered with XREADGROUP and not yet acknowledged.

Summary (XPENDING key group): the number of pending entries, the lowest and highest pending ID, and how many entries each consumer holds.

Extended (XPENDING key group start end count): the pending entries themselves, in ID order.

Argument Effect
IDLE min-idle-time Only entries idle for at least this many milliseconds.
start, end ID range, as for XRANGE: -, +, IDs, and ( for exclusive bounds.
count At most this many entries. 0 or less returns an empty array.
consumer Only entries held by this consumer.

Summary form, an array of four elements:

Element Value
1 Integer: the number of pending entries
2 Bulk string: the lowest pending ID (nil when none)
3 Bulk string: the highest pending ID (nil when none)
4 Array of [consumer, count] pairs, the count as a bulk string (nil when none)

Extended form, an array with one element per entry: [id, consumer, idle-milliseconds, delivery-count], the ID and consumer as bulk strings and the last two as integers.

In RESP3 the nil values are nulls; the shapes are otherwise the same.

Error replies:

  • NOGROUP No such key 'key' or consumer group 'group' when the stream or the group does not exist.
  • ERR syntax error when the extended form is incomplete.
  • ERR value is not an integer or out of range, ERR Invalid stream ID specified as stream command argument, or WRONGTYPE.
127.0.0.1:6379> XADD tasks 1700000000000-0 job email
"1700000000000-0"
127.0.0.1:6379> XADD tasks 1700000000001-0 job sms
"1700000000001-0"
127.0.0.1:6379> XGROUP CREATE tasks workers 0
OK
127.0.0.1:6379> XPENDING tasks workers
1) (integer) 0
2) (nil)
3) (nil)
4) (nil)
127.0.0.1:6379> XREADGROUP GROUP workers alice STREAMS tasks >
1) 1) "tasks"
2) 1) 1) "1700000000000-0"
2) 1) "job"
2) "email"
2) 1) "1700000000001-0"
2) 1) "job"
2) "sms"
127.0.0.1:6379> XPENDING tasks workers
1) (integer) 2
2) "1700000000000-0"
3) "1700000000001-0"
4) 1) 1) "alice"
2) "2"
127.0.0.1:6379> XPENDING tasks workers - + 10 alice
1) 1) "1700000000000-0"
2) "alice"
3) (integer) 5120
4) (integer) 1
2) 1) "1700000000001-0"
2) "alice"
3) (integer) 5120
4) (integer) 1

The idle times depend on when you run the command.

Same as Redis 7 and Valkey 8, including the IDLE filter.

XREADGROUP, XACK, XCLAIM, XAUTOCLAIM, XINFO CONSUMERS