# XGROUP DELCONSUMER

> Remove a consumer from a stream consumer group, dropping its pending entries.

URL: https://docs.hotkv.com/commands/xgroup-delconsumer/

```
XGROUP DELCONSUMER key group consumer
```

- Group: Stream
- Complexity: O(N), N being the consumer's pending entries
- HotKV Cloud: all plans
- On-Premise: no license needed

`XGROUP DELCONSUMER` removes `consumer` from the consumer group `group` and
returns how many pending entries it held. Those entries leave the group's
pending list, so no other consumer can claim them afterwards. Claim them with
[XCLAIM](https://docs.hotkv.com/commands/xclaim/index.md) or [XAUTOCLAIM](https://docs.hotkv.com/commands/xautoclaim/index.md) first if
they still need processing.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Integer: the pending entries the consumer held (`0` if it did not exist) | Integer |

Error replies:

- `NOGROUP No such consumer group 'group' for key name 'key'`
- `ERR The XGROUP subcommand requires the key to exist. ...` when the stream does not exist.
- `WRONGTYPE` if the key holds another type.

## Examples

```
127.0.0.1:6379> XADD tasks 1700000000000-0 job email
"1700000000000-0"
127.0.0.1:6379> XGROUP CREATE tasks workers 0
OK
127.0.0.1:6379> XREADGROUP GROUP workers alice STREAMS tasks >
1) 1) "tasks"
   2) 1) 1) "1700000000000-0"
         2) 1) "job"
            2) "email"
127.0.0.1:6379> XGROUP DELCONSUMER tasks workers alice
(integer) 1
127.0.0.1:6379> XPENDING tasks workers
1) (integer) 0
2) (nil)
3) (nil)
4) (nil)
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[XGROUP CREATECONSUMER](https://docs.hotkv.com/commands/xgroup-createconsumer/index.md), [XINFO CONSUMERS](https://docs.hotkv.com/commands/xinfo-consumers/index.md),
[XGROUP](https://docs.hotkv.com/commands/xgroup/index.md)