getLeader

Description

public function getLeader(): int {}

Topic partition leader id reported by broker

Example

$conf = new SimpleKafkaClient\Configuration();
$conf->set('auto.offset.reset', 'earliest');
$producer = new SimpleKafkaClient\Producer($conf);
$metadata = $producer->getMetadata(false, 10000);
echo sprintf(
    'Topic partition leader: %d',
    $metadata->getTopics()->current()->getPartitions()->current()->getLeader()
) . PHP_EOL;