PHP Class Kafka\ZooKeeper

Author: $_SWANBR_AUTHOR_$ +------------------------------------------------------------------------------
Inheritance: implements Kafka\ClusterMetaData
Datei anzeigen Open project: nmred/kafka-php

Public Methods

Method Description
__construct ( $hostList, null $timeout = null ) __construct
addPartitionOwner ( string $groupId, string $topicName, integer $partitionId, string $consumerId ) : void add partition owner
cancelWatch ( string $path, callable $callback = null ) : boolean | null Delete watch callback on a node, delete all callback when $callback is null
getBrokerDetail ( integer $brokerId ) : string | boolean get broker detail
getConsumersPerTopic ( string $groupId ) : array get consumer per topic
getPartitionState ( string $topicName, integer $partitionId ) : string | boolean get partition state
getTopicDetail ( string $topicName ) : string | boolean get topic detail
listBrokers ( ) : array get broker list using zookeeper
listConsumer ( string $groupId ) : array list consumer
refreshMetadata ( ) : null Clear internal caches
registerConsumer ( $groupId, integer $consumerId, array $topics = [] ) register consumer
watch ( string $path, callable $callback ) : string | null Wath a given path
watchCallback ( integer $event_type, integer $stat, string $path ) : the Wath event callback warper

Protected Methods

Method Description
makeZkNode ( string $path, mixed $value, $flag = null ) : boolean Create a node on ZooKeeper at the given path
makeZkPath ( string $path, mixed $value ) : boolean Equivalent of "mkdir -p" on ZooKeeper

Method Details

__construct() public method

__construct
public __construct ( $hostList, null $timeout = null )
$hostList
$timeout null

addPartitionOwner() public method

add partition owner
public addPartitionOwner ( string $groupId, string $topicName, integer $partitionId, string $consumerId ) : void
$groupId string
$topicName string
$partitionId integer
$consumerId string
return void

cancelWatch() public method

Delete watch callback on a node, delete all callback when $callback is null
public cancelWatch ( string $path, callable $callback = null ) : boolean | null
$path string
$callback callable
return boolean | null

getBrokerDetail() public method

get broker detail
public getBrokerDetail ( integer $brokerId ) : string | boolean
$brokerId integer
return string | boolean

getConsumersPerTopic() public method

get consumer per topic
public getConsumersPerTopic ( string $groupId ) : array
$groupId string
return array

getPartitionState() public method

get partition state
public getPartitionState ( string $topicName, integer $partitionId ) : string | boolean
$topicName string
$partitionId integer
return string | boolean

getTopicDetail() public method

get topic detail
public getTopicDetail ( string $topicName ) : string | boolean
$topicName string
return string | boolean

listBrokers() public method

get broker list using zookeeper
public listBrokers ( ) : array
return array

listConsumer() public method

list consumer
public listConsumer ( string $groupId ) : array
$groupId string
return array

makeZkNode() protected method

Create a node on ZooKeeper at the given path
protected makeZkNode ( string $path, mixed $value, $flag = null ) : boolean
$path string The path to the node
$value mixed The value to assign to the new node
return boolean

makeZkPath() protected method

Equivalent of "mkdir -p" on ZooKeeper
protected makeZkPath ( string $path, mixed $value ) : boolean
$path string The path to the node
$value mixed The value to assign to each new node along the path
return boolean

refreshMetadata() public method

Clear internal caches
public refreshMetadata ( ) : null
return null

registerConsumer() public method

register consumer
public registerConsumer ( $groupId, integer $consumerId, array $topics = [] )
$groupId
$consumerId integer
$topics array

watch() public method

Wath a given path
public watch ( string $path, callable $callback ) : string | null
$path string the path to node
$callback callable callback function
return string | null

watchCallback() public method

Wath event callback warper
public watchCallback ( integer $event_type, integer $stat, string $path ) : the
$event_type integer
$stat integer
$path string
return the return of the callback or null