Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
/**
 * @return the client's assigned instance id used for metrics collection.
 * @throws TimeoutException      Indicates that a request timed out
 */
public String clientInstanceId(Duration timeout);

If the client has not yet requested a client instance id from the broker, this call may block up to the duration of the timeout. If no In the event that the client instance id can cannot be retrieved obtained within the timeout, an error is returned (such as timeout, feature not supported by broker, auth failure)the method throws org.apache.kafka.common.errors.TimeoutException .

In addition, the following method is added to the KafkaStreams interface to give access to the client instance ids of the producers, consumers and admin clients used by Kafka Streams:

Code Block
/**
 * @return the clients' assigned instance ids used for metrics collection.
 */
public ClientsInstanceIds@throws clientsInstanceId(Duration timeout);

The new class org.apache.kafka.streams.ClientsInstanceIds is defined as follows:

TimeoutException      Indicates that a request timed out
 */
public ClientInstanceIds clientInstanceIds(Duration timeout);

In the event that any of the client instance ids cannot be obtained within the timeout, the method throws org.apache.kafka.common.errors.TimeoutException .

The new class org.apache.kafka.streams.ClientInstanceIds is defined as follows:

Code Block
/**
 * Encapsulates
Code Block
/**
 * Encapsulates the client instance ids used for metrics collection by
 * producers, consumers and admin clients used by Kafka Streams.
 */
public class ClientsInstanceIds {
  /**
   * Get the client instance id of the admin client
   *
   * @return the client instance id 
   */
  String adminInstanceId();

   /**
   * Get the client instance ids idused offor themetrics globalcollection consumerby
   *
 producers, consumers *and @returnadmin theclients clientused instanceby id, if anyKafka Streams.
   */
public class Optional<String> globalConsumerInstanceId();

ClientInstanceIds {
  /**
   * Get the client instance idsid of the mainadmin consumersclient
   *
   * @return a map from thread key tothe client instance id 
   */
  Map<String, String> mainConsumerInstanceIdsString adminInstanceId();

  /**
   * Get the client instance ids of the restore consumers
   *
   * @return a map from thread key to client instance id
    */
  Map<String, String> restoreConsumerInstanceIdsconsumerInstanceIds();

  /**
   * Get the client instance idids of the producers
   *
   * @return a map from thread key to client instance id
   */
  Map<String, String> producerInstanceIds();
}

...