# XINFO CONSUMERS

> List the consumers of a stream consumer group with their pending counts and idle times.

URL: https://docs.hotkv.com/commands/xinfo-consumers/

```
XINFO CONSUMERS key group
```

- Group: Stream
- Complexity: O(1) per consumer
- HotKV Cloud: all plans
- On-Premise: no license needed

`XINFO CONSUMERS` returns one record per consumer of the group `group` on the
stream at `key`, ordered by consumer name.

## Fields

| Field | Meaning |
| --- | --- |
| `name` | The consumer's name. |
| `pending` | Entries the consumer holds that are not yet acknowledged. |
| `idle` | Milliseconds since the consumer last read, claimed or was created. |
| `inactive` | Milliseconds since the consumer last received entries from [XREADGROUP](https://docs.hotkv.com/commands/xreadgroup/index.md) or claimed some with [XCLAIM](https://docs.hotkv.com/commands/xclaim/index.md) or [XAUTOCLAIM](https://docs.hotkv.com/commands/xautoclaim/index.md). `-1` for a consumer that never has, for example one made with [XGROUP CREATECONSUMER](https://docs.hotkv.com/commands/xgroup-createconsumer/index.md) that has not read. |

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Group exists | Array with one flat array of field names and values per consumer | Array of maps |

Error replies:

- `NOGROUP No such consumer group 'group' for key name 'key'`
- `ERR no such key` when the stream does not exist, and `WRONGTYPE`.

## 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> XINFO CONSUMERS tasks workers
1) 1) "name"
   2) "alice"
   3) "pending"
   4) (integer) 1
   5) "idle"
   6) (integer) 2310
   7) "inactive"
   8) (integer) 2310
```

A consumer that was made but has not read or claimed anything reports
`inactive` as `-1`:

```
127.0.0.1:6379> XGROUP CREATE tasks reviewers 0
OK
127.0.0.1:6379> XGROUP CREATECONSUMER tasks reviewers bob
(integer) 1
127.0.0.1:6379> XINFO CONSUMERS tasks reviewers
1) 1) "name"
   2) "bob"
   3) "pending"
   4) (integer) 0
   5) "idle"
   6) (integer) 41
   7) "inactive"
   8) (integer) -1
```

The idle times depend on when you run the command.

## Compatibility

Same fields as Redis 7.2 and Valkey 8. As in Redis, `inactive` counts from
the consumer's last successful read and is `-1` for a consumer that never read
anything.

## See also

[XINFO](https://docs.hotkv.com/commands/xinfo/index.md), [XINFO GROUPS](https://docs.hotkv.com/commands/xinfo-groups/index.md), [XGROUP DELCONSUMER](https://docs.hotkv.com/commands/xgroup-delconsumer/index.md),
[XPENDING](https://docs.hotkv.com/commands/xpending/index.md)