Interface PartitionLeaders


public interface PartitionLeaders
A snapshot of partition leader assignments, returned by TopologyService.leaders(java.util.Map<java.lang.String, java.util.Set<java.lang.String>>).

This is a self-contained result — callers should use it directly rather than querying the topology cache separately. The snapshot is immutable and safe to use across async callback boundaries.

  • Method Summary

    Modifier and Type
    Method
    Description
    leaderOf(String topicName, int partitionIndex)
    Returns the leader for the given topic-partition, or empty if the leader was not discovered (e.g. the topic does not exist, or the partition has no leader).
  • Method Details

    • leaderOf

      Optional<VirtualNode> leaderOf(String topicName, int partitionIndex)
      Returns the leader for the given topic-partition, or empty if the leader was not discovered (e.g. the topic does not exist, or the partition has no leader).
      Parameters:
      topicName - the topic name
      partitionIndex - the partition index
      Returns:
      the leader's virtual node, or empty