C# 클래스 Kafka.Client.Producers.Partitioning.ZKBrokerPartitionInfo

Fetch broker info like ID, host, port and number of partitions from ZooKeeper.
Used when zookeeper based auto partition discovery is enabled
상속: IBrokerPartitionInfo, IZooKeeperStateListener
파일 보기 프로젝트 열기: precog/kafka 1 사용 예제들

공개 메소드들

메소드 설명
Dispose ( ) : void

Closes underlying connection to ZooKeeper

GetAllBrokerInfo ( ) : Broker>.IDictionary

Gets a mapping from broker ID to the host and port for all brokers

GetBrokerInfo ( int brokerId ) : Broker

Gets the host and port information for the broker identified by the given broker ID

GetBrokerPartitionInfo ( string topic ) : SortedSet

Gets a mapping from broker ID to partition IDs

HandleSessionCreated ( ZooKeeperSessionCreatedEventArgs args ) : void

Called after the ZooKeeper session has expired and a new session has been created.

We would have to re-create any ephemeral nodes here.

HandleStateChanged ( ZooKeeperStateChangedEventArgs args ) : void

Called when the ZooKeeper connection state has changed.

Do nothing, since zkclient will do reconnect for us.

ZKBrokerPartitionInfo ( IZooKeeperClient zkclient ) : System

Initializes a new instance of the ZKBrokerPartitionInfo class.

ZKBrokerPartitionInfo ( Kafka.Client.Cfg.ProducerConfiguration config, Action callback ) : System

Initializes a new instance of the ZKBrokerPartitionInfo class.

비공개 메소드들

메소드 설명
BootstrapWithExistingBrokers ( string topic ) : SortedSet

Add the all available brokers with default one partition for new topic, so all of the brokers participate in hosting this topic

Since we do not have the in formation about number of partitions on these brokers, just assume single partition just pick partition 0 from each broker as a candidate

EnsuresNotDisposed ( ) : void

Ensures that object was not disposed

InitializeBrokers ( ) : void

Initializes the list of brokers.

InitializeTopicBrokerPartitions ( ) : void

Initializes the topic - broker's partitions mappings.

RegisterListeners ( ) : void

Registers the listeners under several path in ZooKeeper to keep related data structures updated.

Watch on following path: /broker/topics /broker/topics/[topic] /broker/ids

Reset ( ) : void

Resets the related data structures

메소드 상세

Dispose() 공개 메소드

Closes underlying connection to ZooKeeper
public Dispose ( ) : void
리턴 void

GetAllBrokerInfo() 공개 메소드

Gets a mapping from broker ID to the host and port for all brokers
public GetAllBrokerInfo ( ) : Broker>.IDictionary
리턴 Broker>.IDictionary

GetBrokerInfo() 공개 메소드

Gets the host and port information for the broker identified by the given broker ID
public GetBrokerInfo ( int brokerId ) : Broker
brokerId int The broker ID.
리턴 Kafka.Client.Cluster.Broker

GetBrokerPartitionInfo() 공개 메소드

Gets a mapping from broker ID to partition IDs
public GetBrokerPartitionInfo ( string topic ) : SortedSet
topic string The topic for which this information is to be returned
리턴 SortedSet

HandleSessionCreated() 공개 메소드

Called after the ZooKeeper session has expired and a new session has been created.
We would have to re-create any ephemeral nodes here.
public HandleSessionCreated ( ZooKeeperSessionCreatedEventArgs args ) : void
args Kafka.Client.ZooKeeperIntegration.Events.ZooKeeperSessionCreatedEventArgs The instance containing the event data.
리턴 void

HandleStateChanged() 공개 메소드

Called when the ZooKeeper connection state has changed.
Do nothing, since zkclient will do reconnect for us.
public HandleStateChanged ( ZooKeeperStateChangedEventArgs args ) : void
args Kafka.Client.ZooKeeperIntegration.Events.ZooKeeperStateChangedEventArgs The instance containing the event data.
리턴 void

ZKBrokerPartitionInfo() 공개 메소드

Initializes a new instance of the ZKBrokerPartitionInfo class.
public ZKBrokerPartitionInfo ( IZooKeeperClient zkclient ) : System
zkclient IZooKeeperClient The wrapper above ZooKeeper client.
리턴 System

ZKBrokerPartitionInfo() 공개 메소드

Initializes a new instance of the ZKBrokerPartitionInfo class.
public ZKBrokerPartitionInfo ( Kafka.Client.Cfg.ProducerConfiguration config, Action callback ) : System
config Kafka.Client.Cfg.ProducerConfiguration The config.
callback Action The callback invoked when new broker is added.
리턴 System