Stream

XCLAIM

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.

idsbodystring | string[]required

The ID(s) of the message(s) to claim. Can be a single ID or an array of IDs.

optionsbody

Response

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

Returns an array of claimed messages. If justid option is used, returns only message IDs.

Basic claim
const result = await redis.xclaim(  "mystream",  "mygroup",  "consumer1",  60000,  ["1638360173533-0", "1638360173533-1"]);
With justid option
const result = await redis.xclaim(  "mystream",  "mygroup",   "consumer1",  60000,  ["1638360173533-0"],  { justid: true, force: true });
[  ["1638360173533-0", ["field1", "value1", "field2", "value2"]],  ["1638360173533-1", ["field1", "value3", "field2", "value4"]]]
Loading search…