Stream

XAUTOCLAIM

Changes the ownership of pending messages from one consumer to another in a stream consumer group.

Arguments

keybodystringrequired

The key of the stream.

groupbodystringrequired

The consumer group name.

consumerbodystringrequired

The consumer name that will claim the messages.

minIdleTimebodynumberrequired

The minimum idle time in milliseconds for messages to be claimed.

startbodystringrequired

The stream entry ID to start claiming from.

optionsbodyobject

Response

[string, Array<[string, string[]]>, string[]]

Returns a tuple containing:

  • Next start ID for pagination
  • Array of claimed messages (ID and field-value pairs)
  • Array of deleted message IDs
Basic autoclaim
const result = await redis.xautoclaim(  "mystream",  "mygroup",   "consumer1",  60000,  "0-0");
With count and justid
const result = await redis.xautoclaim(  "mystream",  "mygroup",  "consumer1",   60000,  "0-0",  { count: 5, justid: true });
[  "1638360173533-1", // next start ID  [["1638360173533-0", ["field1", "value1", "field2", "value2"]]], // claimed messages  [] // deleted message IDs]
Loading search…