Arguments
The consumer name within the group.
key
string | string[]
required
The stream key(s) to read from. Can be a single stream key or an array of stream keys for multiple streams.
ids
string | string[]
required
The starting ID(s) to read from. Use ”>” to read messages never delivered to any consumer in the group.
For multiple streams, provide an array of IDs corresponding to each stream.
The maximum number of messages to return per stream.
Don’t add messages to the pending entries list (messages won’t need acknowledgment).
Response
Returns an array where each element represents a stream and contains:
The stream key
An array of messages (ID and field-value pairs)
Returns null if no data is available.
Read new messages
With count option
With NOACK option
Multiple streams
Read pending messages
const result = await redis . xreadgroup ( "mygroup" , "consumer1" , "mystream" , ">" );
const result = await redis . xreadgroup ( "mygroup" , "consumer1" , "mystream" , ">" , {
count: 5
});
const result = await redis . xreadgroup ( "mygroup" , "consumer1" , "mystream" , ">" , {
NOACK: true
});
const result = await redis . xreadgroup (
"mygroup" ,
"consumer1" ,
[ "stream1" , "stream2" ],
[ ">" , ">" ],
{ count: 1 }
);
const result = await redis . xreadgroup ( "mygroup" , "consumer1" , "mystream" , "0" );
[
[ "mystream" , [
[ "1638360173533-0" , [ "field1" , "value1" , "field2" , "value2" ]],
[ "1638360173533-1" , [ "field1" , "value3" , "field2" , "value4" ]]
]]
]