mirror of
https://gitee.com/shikong-sk/springcloud-study
synced 2024-11-09 01:51:19 +08:00
broker 信息获取
This commit is contained in:
parent
afdf7c8187
commit
8edf010aa2
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user