KIP-367 Introduce close(Duration) to Producer and AdminClient instead of close(long, TimeUnit)
Table of Contents |
---|
This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.
Status
Current state: discussing Accepted
Discussion thread: thread
JIRA: TBD KAFKA-7391
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
...
KIP-266 have replaced the (long, TimeUnit) by Duration for KafkaConsumer. For consistency, we should do the same APIs migration for KafkaProducer and KafkaAdminClient.
Public Interfaces
KafkaProducer
Code Block | ||||
---|---|---|---|---|
| ||||
@Deprecated @Override public void close(long timeout, TimeUnit timeUnit) { close(timeout, timeUnit, false); } @Override public void close(Duration timeout) { close(timeout.toMillis(), TimeUnit.MILLISECONDS, false); } |
Producer
Code Block | ||||
---|---|---|---|---|
| ||||
@Deprecated void close(long timeout, TimeUnit unit); void close(Duration timeout); |
...
Code Block | ||||
---|---|---|---|---|
| ||||
@Override public void close(Duration timeout) { @Deprecated public void close(long duration, TimeUnit unit) |
Noted: the implementation of close(long, TimeUnit) will be placed at AdminClient.
AdminClient
Code Block | ||||
---|---|---|---|---|
| ||||
@Deprecated public abstract void close(long duration, TimeUnit unit) { close(Duration.ofMillis(unit.toMillis(duration))); } public abstract void close(Duration timeout); |
Noted: there is a default implementation of close(long, TimeUnit).
Proposed Changes
New Public methods are proposed. see Public Interfaces
In short, this KIP is going to deprecate close(long, TimeUnit) of KafkaProducer and KafkaAdminClient and add a replacement method - close(Duration)
Compatibility, Deprecation, and Migration Plan
...