/// <summary> /// Called after the ZooKeeper session has expired and a new session has been created. /// </summary> /// <param name="args"> /// The <see cref="Kafka.Client.ZooKeeperIntegration.Events.ZooKeeperSessionCreatedEventArgs" /> /// instance containing the event data. /// </param> /// <remarks> /// You would have to re-create any ephemeral nodes here. /// Explicitly trigger load balancing for this consumer. /// </remarks> public void HandleSessionCreated(ZooKeeperSessionCreatedEventArgs args) { Guard.NotNull(args, "args"); // Notify listeners that ZK session has expired OnZKSessionExpired(EventArgs.Empty); Logger.InfoFormat("ZK session expired; release old broker partition ownership; re-register consumer {0}", consumerIdString); loadBalancerListener.ResetState(); zkConsumerConnector.RegisterConsumerInZk(dirs, consumerIdString, topicCount); Logger.Info("Performing rebalancing. ZK session has previously expired and a new session has been created"); loadBalancerListener.AsyncRebalance(); }