Max Rothman created KAFKA-12422:
-----------------------------------

             Summary: Add getter for KafkaConsumer configs
                 Key: KAFKA-12422
                 URL: https://issues.apache.org/jira/browse/KAFKA-12422
             Project: Kafka
          Issue Type: Improvement
          Components: clients
            Reporter: Max Rothman


Given a 
[KafkaConsumer|https://kafka.apache.org/26/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html],
 there is currently no way to inspect the config that it was instantiated with. 
This is a problem when building abstractions around KafkaConsumer instances 
that only accept certain configurations.

For example, if you want to build a reusable poll loop helper that manually 
handles committing offsets, the default value for {{enable.auto.commit}} (true) 
will silently cause unexpected behavior in offset committing. The only two 
options for preventing that bug right now are to add a big comment to the 
helper's doc or to have the helper construct its own KafkaConsumer. The latter 
is unsavory because it's an unsafe-by-default design, and the latter 
unnecessarily restricts the possible configurations a KafkaConsumer can be in. 
The helper could take a list of topics to subscribe to, but what if the 
helper's user wants to use {{assign}} rather than {{subscribe}}?

As a straw man, I propose the following method be added to KafkaConsumer:
{code:java}
Object getProperty(String key){code}
It would simply return the corresponding value from the KafkaConsumer 
instance's ConsumerConfig.



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

Reply via email to