Click to copy

• Reviewed for ksqlDB 0.29

How to Count Consumer Groups Subscribed to Topic in ksqlDB

Use a LIST statement with the EXTENDED modifier to get that consumer group information:

LIST TOPICS EXTENDED;

that returns

Kafka Topic     | Partitions | Replicas | Consumers | ConsumerGroups
---------------------------------------------------------------------
 FLIGHTS        | 10         | 3        | 0         | 0
 FLORIDA_TWEETS | 1          | 3        | 1         | 1
 LONDON_TWEETS  | 10         | 3        | 20        | 2
---------------------------------------------------------------------
Up to version 0.27, the only way to get information from one of the topics is by listing all of the topics.

The ConsumerGroups count is the total amount of consumer groups that are subscribed to that topic. M ost of the time, a consumer group is used per service, so you can also get an idea of how many different services are subscribed to that topic.

On the other hand, t he Consumers count is the number of partitions that are being consumed. For example, let’s assume that 2 consumer groups are subscribed to all 5 partitions in a topic. If both consumer groups are consuming that topic, the total number of partitions would be 10 (5*2).

Discover what readers are saying
topictale
Get easy to digest how-tos on ksqlDB
Sign up
Please read our Privacy Policy to understand how we protect and manage your data.
You may also like