Versions Compared

Key

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

...

  • Client Behaviors

    • Clients won’t attempt to resolve the bootstrap addresses upon initialization.

    • Clients won’t exit fatally if DNS resolution fails.

    • KafkaConsumer: Users must poll to retry the lookup if it fails.

    • KafkaAdminClient: Users will need to resend the request if failing.

    • KafkaProducer: The sender loop should already be polling continuously.

    Exception Handling

    • Failed DNS resolution will result in NetworkException

Case Study

Here we demonstrate the new expected behavior.

KafkaConsumer

Case 1: Unable to connect to the bootstrap (For example: misconfiguration)

  1. The user tries to create a consumer with an invalid bootstrap addressconfig.  The client was instantiated without an error.
  2. The user invokes assign() and starts poll()
  3. The poll returns an empty Consumer Record and logs an errora WARN message.
  4. The user continues to retry for the configured duration
  5. The client throws BootstrapConnectionException after the timeout expires.

Case 2: Transient Network Issue (For example: transient DNS failure)

  1. The user tries to create a consumer with an invalid bootstrap addressconfig.  The client was instantiated without an error.
  2. The user invokes assign() and starts poll()
  3. The poll returns an empty Consumer Record and logs an errora WARN message.
  4. The user continues to retry, and the address is successfully resolved after x msThe poll returns some ConsumerRecrods.

KafkaProducer

Case 1: Unable to connect to the bootstrap (For example: misconfiguration)

  1. The user instantiates a new producer; the producer creates is created and starts a sender thread.
  2. Upon the first runOnce(), client.poll was invoked, which attempts to bootstrap the client. Failure was As the sender thread starts running, a WARN message is logged.
  3. The user tries to produce a message, but because of misconfiguration, the send() will continue to fail on waitOnMetadata until the bootstrap timeout expires.
  4. Depending on the configuration...
    1. The producer callback may be completed with TimeoutException until
    Once
    1. the bootstrap timeout
    expires, a BootstrapConnectionException is thrown
    1. runs out.
    2. A BootstrapConnectionException will be thrown eventually.

Case 2: Transient Network Issue (For example: transient DNS failure)

  1. The user creates a producer, ; the sender loop continues to try to connect to the bootstrap server.
  2. A WARN message will be logged every time the networkClient tries to make a connection.The user retries, eventually successfully send
    1. Several send() calls fails with TimeoutException (waitOnMetadata)
      1. Eventually, the send callback will be completed with TimeoutException

    AdminClient

    Case 1: Unable to connect to the bootstrap (For example: misconfiguration)

    ...