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
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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