You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "David Mollitor (Jira)" <ji...@apache.org> on 2020/01/11 18:34:00 UTC

[jira] [Created] (KAFKA-9400) Make Consumer Class Extend AutoCloseable

David Mollitor created KAFKA-9400:
-------------------------------------

             Summary: Make Consumer Class Extend AutoCloseable
                 Key: KAFKA-9400
                 URL: https://issues.apache.org/jira/browse/KAFKA-9400
             Project: Kafka
          Issue Type: Improvement
            Reporter: David Mollitor


{quote}
 The consumer maintains TCP connections to the necessary brokers to fetch data.
 Failure to close the consumer after use will leak these connections.
{quote}

https://github.com/apache/kafka/blob/505e8240cd29fe3f0effa96d794bc711d5c8423b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L92-L94

To assist in making sure that consumers are closed, please have the Consumer interface extend AutoCloseable.

https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)