Request cluster topology
This example shows which broker is leader and follower for which partition. This is particularly useful when you run a cluster with multiple Zeebe brokers.
Related resources
Prerequisites
Run the Zeebe broker with endpoints, localhost:8080
(default REST) and localhost:26500
(default gRPC).
TopologyViewer.java
final Topology topology = client.newTopologyRequest().send().join();
System.out.println("Topology:");
topology
.getBrokers()
.forEach(
b -> {
System.out.println(" " + b.getAddress());
b.getPartitions()
.forEach(
p ->
System.out.println(
" " + p.getPartitionId() + " - " + p.getRole()));
});