broker 信息获取

This commit is contained in:
Shikong 2023-04-26 19:06:57 +08:00
parent afdf7c8187
commit 8edf010aa2

View File

@ -52,6 +52,18 @@ public class KafkaConfigTest {
return AdminClient.create(kafkaProperties.buildAdminProperties());
}
@Test
@SneakyThrows
void clusterInfo(){
try(AdminClient client = adminClient()){
DescribeClusterResult result = client.describeCluster();
log.info("kafka 集群信息");
result.nodes().get().forEach(broker -> {
log.info("broker id => {}, Addr => {}:{}",broker.id(),broker.host(),broker.port());
});
}
}
@Test
@SneakyThrows
void topics() {