diff options
Diffstat (limited to 'iredis/data/commands/xgroup.md')
-rw-r--r-- | iredis/data/commands/xgroup.md | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/iredis/data/commands/xgroup.md b/iredis/data/commands/xgroup.md index b690d87..80948a6 100644 --- a/iredis/data/commands/xgroup.md +++ b/iredis/data/commands/xgroup.md @@ -11,7 +11,7 @@ To create a new consumer group, use the following form: XGROUP CREATE mystream consumer-group-name $ The last argument is the ID of the last item in the stream to consider already -delivered. In the above case we used the special ID '\$' (that means: the ID of +delivered. In the above case we used the special ID '$' (that means: the ID of the last item in the stream). In this case the consumers fetching data from that consumer group will only see new elements arriving in the stream. @@ -22,8 +22,9 @@ starting ID for the consumer group: Of course it is also possible to use any other valid ID. If the specified consumer group already exists, the command returns a `-BUSYGROUP` error. -Otherwise the operation is performed and OK is returned. There are no hard -limits to the number of consumer groups you can associate to a given stream. +Otherwise, the operation is performed and a @simple-string-reply `OK` is +returned. There are no hard limits to the number of consumer groups you can +associate with a given stream. If the specified stream doesn't exist when creating a group, an error will be returned. You can use the optional `MKSTREAM` subcommand as the last argument @@ -38,16 +39,26 @@ A consumer group can be destroyed completely by using the following form: The consumer group will be destroyed even if there are active consumers and pending messages, so make sure to call this command only when really needed. +This form returns an @integer-reply with the number of destroyed consumer groups +(0 or 1). + +Consumers in a consumer group are auto-created every time a new consumer name is +mentioned by some command. They can also be explicitly created by using the +following form: + + XGROUP CREATECONSUMER mystream consumer-group-name myconsumer123 + +This form returns an @integer-reply with the number of created consumers (0 or +1). To just remove a given consumer from a consumer group, the following form is used: XGROUP DELCONSUMER mystream consumer-group-name myconsumer123 -Consumers in a consumer group are auto-created every time a new consumer name is -mentioned by some command. However sometimes it may be useful to remove old -consumers since they are no longer used. This form returns the number of pending -messages that the consumer had before it was deleted. +Sometimes it may be useful to remove old consumers since they are no longer +used. This form returns an @integer-reply with the number of pending messages +that the consumer had before it was deleted. Finally it possible to set the next message to deliver using the `SETID` subcommand. Normally the next ID is set when the consumer is created, as the @@ -58,7 +69,13 @@ messages in a stream, you may want to set its next ID to 0: XGROUP SETID mystream consumer-group-name 0 +This form returns a @simple-string-reply `OK` or an error. + Finally to get some help if you don't remember the syntax, use the HELP subcommand: XGROUP HELP + +@history + +- `>= 6.2.0`: Supports the `CREATECONSUMER` subcommand. |