Use XCLAIM to change the owner of specific pending entries in a consumer group.
The entries must have been idle for at least <min-idle-time> milliseconds, which is what keeps two recovery attempts from stealing the same work from each other: the first claim resets the idle time and the second one then finds nothing to take. Claiming resets the entry's delivery time and increments its delivery counter, unless JUSTID is used, which returns only the IDs and leaves the counter alone.
IDLE and TIME set the new idle time or the last delivery time explicitly, RETRYCOUNT overrides the delivery counter, and FORCE creates a pending entry for IDs that exist in the stream but are not currently pending. Entries that no longer exist in the stream are removed from the pending list instead of being claimed.
When you want to claim whatever is idle rather than specific IDs, use XAUTOCLAIM.
Syntax#
Arguments#
| Argument | Required | Repeatable | Description |
|---|---|---|---|
<key> | Yes | No | Redis key targeted by the command. |
<group> | Yes | No | Consumer group name. |
<consumer> | Yes | No | Consumer name within the group. |
<min-idle-time> | Yes | No | Only claim entries that have been idle at least this many milliseconds. |
<ID> | Yes | Yes | Stream entry ID. |
IDLE <ms> | No | No | Set the entry's idle time to this many milliseconds. |
TIME <unix-time-milliseconds> | No | No | Set the entry's last-delivery time to this Unix timestamp in milliseconds. |
RETRYCOUNT <count> | No | No | Set the entry's delivery counter to this value. |
FORCE | No | No | Create the pending entry even when the ID is not in the group's pending list. |
JUSTID | No | No | Return only entry IDs, without their fields and values. |
LASTID <lastid> | No | No | New last-delivered ID for the group. |
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.
| Protocol | Reply |
|---|---|
| RESP2 | Array of entry arrays, or array of IDs with JUSTID |
| RESP3 | Array of entry arrays, or array of IDs with JUSTID |
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 TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.