doc: 阅读redis stream文档
This commit is contained in:
@@ -100,6 +100,7 @@
|
||||
- [XREAD with STREAMS option](#xread-with-streams-option)
|
||||
- [XREAD with BLOCK argument](#xread-with-block-argument)
|
||||
- [Consumer groups](#consumer-groups)
|
||||
- [Creating a consumer group](#creating-a-consumer-group)
|
||||
|
||||
|
||||
# redis
|
||||
@@ -1655,3 +1656,14 @@ consumer group包含如下的基本命令:
|
||||
- XACK
|
||||
- XACKDEL
|
||||
|
||||
##### Creating a consumer group
|
||||
可以通过如下方式来为stream创建一个consumer group:
|
||||
```redis-cli
|
||||
> XGROUP CREATE race:france france_riders $
|
||||
OK
|
||||
```
|
||||
在上述示例中,在通过command创建consumer group时,以`$`的形式指定了一个`ID`。该ID是必要的,该ID将作为consumer group创建时的`last message ID`,在第一个consumer连接时,会根据向consumer传递`大于last message ID的消息`。
|
||||
- 当将last message ID指定为`$`时,只有`new messages arriving in the stream from now on`会被传递给consumer group中的consumer instances。由于`$`代表`current greatest ID in the stream`,指定`$`代表`consuming only new messages`
|
||||
- 如果在此处指定了`0`,那么consumer group将会消费`all the messages in the stream history`
|
||||
- 此处,也可以指定其他的`valid ID`,`consumer group will start delivering messages that are greater than the ID you specify`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user