0

I am doing this way currently to get the groupmetadata for list of consumers

    admin = AdminClient({ 'bootstrap.servers' : config['kafka']['brokers']  })
for group in config['kafka']['groups']:
    metadata = admin.list_groups(group)
    print(metadata[0].state)

Is there a way to achieve the below

metadata = admin.list_groups(config['kafka']['groups']) //list of groups

It throws an error that it expects only one string argument, the next one is an integer.

But when I checked the doc, this, I expect that it would work for selected groups.

What am I missing here? is there a way to achieve this?

Thanks.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Gibbs
  • 21,904
  • 13
  • 74
  • 138

1 Answers1

0

The docs say group param is only str, not list(str)

If you don't provide it, it will return all groups, which you could then choose to filter, based on your config.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Yes, I agree. But the cluster has 400+ groups whereas I need to filter groups but not more than 30. Is there a way? like describe groups in kafka-python? – Gibbs Nov 16 '22 at 04:08
  • Not that I know of. The API that you found is the only way. Your original loop seems like the only way to do what you want, then – OneCricketeer Nov 16 '22 at 22:02