Skip to main content

XGROUP

Manage consumer groups for Redis streams.
2 min read

Arguments#

keystringrequired#

The key of the stream.

subcommandobjectrequired#

The XGROUP subcommand and its parameters. Can be one of:

Show CREATE
type'CREATE'required#

Create a new consumer group.

groupstringrequired#

The consumer group name.

idstring | '$'required#

The stream entry ID to start consuming from. Use '$' to start from the end.

options#
Show options
MKSTREAMboolean#

Create the stream if it doesn't exist.

ENTRIESREADnumber#

Set the number of entries read by the group.

Show CREATECONSUMER
type'CREATECONSUMER'required#

Create a new consumer in the group.

groupstringrequired#

The consumer group name.

consumerstringrequired#

The consumer name to create.

Show DELCONSUMER
type'DELCONSUMER'required#

Delete a consumer from the group.

groupstringrequired#

The consumer group name.

consumerstringrequired#

The consumer name to delete.

Show DESTROY
type'DESTROY'required#

Delete the entire consumer group.

groupstringrequired#

The consumer group name to destroy.

Show SETID
type'SETID'required#

Set the last delivered ID for the group.

groupstringrequired#

The consumer group name.

idstring | '$'required#

The stream entry ID to set as the last delivered ID.

options#
Show options
ENTRIESREADnumber#

Set the number of entries read by the group.

Response#

The return type depends on the subcommand:

  • CREATE: Returns "OK" string
  • CREATECONSUMER: Returns 1 if created, 0 if already exists
  • DELCONSUMER: Returns the number of pending messages the consumer had
  • DESTROY: Returns 1 if destroyed, 0 if group didn't exist
  • SETID: Returns "OK" string

Was this page helpful?