Versions Compared

Key

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

...

Current KafkaProducer.close() method will try to finish sending all pending messages before it returns. There are several multivations motivations to add a close method with timeout in the producer.

  1. Sometimes, user will want to close a producer wiithin a bounded time to avoid blocking on producer.close() for too long.
  2. One specific use case of 1) is that in some scenarios, user will want to close the produce immediately and fail all the unsent messages in RecordAccumulator. (e.g. to preserve order Some examples are:
    1. In mirror maker, if a send failed
    ).
    1. , we don't want to continue sending messages in RecordAccumulator to avoid reordering.
    2. For people who are using deployment tools, a service is expected

So we need to provide an interface that allow user to choose to close producer in which way.

...