Skip to main content

Arguments

key
string
required
The key of the stream.
group
string
required
The consumer group name.
consumer
string
required
The consumer name that will claim the messages.
minIdleTime
number
required
The minimum idle time in milliseconds for messages to be claimed.
ids
string | string[]
required
The ID(s) of the message(s) to claim. Can be a single ID or an array of IDs.
options

Response

Returns an array of claimed messages. If justid option is used, returns only message IDs.
const result = await redis.xclaim(
  "mystream",
  "mygroup",
  "consumer1",
  60000,
  ["1638360173533-0", "1638360173533-1"]
);
[
  ["1638360173533-0", ["field1", "value1", "field2", "value2"]],
  ["1638360173533-1", ["field1", "value3", "field2", "value4"]]
]
I