12345678910111213141516171819202122 |
- def get_members(self, node_id, group_name):
- describe_groups_request = admin.DescribeGroupsRequest_v0(
- groups=[(group_name)]
- )
- future = self.client.send(node_id, describe_groups_request)
- self.client.poll(timeout_ms=self.timeout, future=future)
- (error_code, group_id, state, protocol_type, protocol, members) = future.value.groups[0]
- if error_code != 0:
- print(
- "Kafka API - RET admin.DescribeGroupsRequest, error_code={}, group_id={}, state={}, protocol_type={}, protocol={}, members_count={}".format(
- error_code, group_id, state, protocol_type, protocol, len(members)))
- exit(1)
- lmembers=[]
- for member in members:
- (member_id, client_id, client_host, member_metadata, member_assignment) = member
- lmembers.append({'member_id': member_id, 'client_id': client_id, 'client_host': client_host})
- return lmembers
|