8

The use case is following. I am passing producer or consumer reference over many objects instances in Java code. At some of them I would like to do some checks for the Kafka configuration. It means I would like to get back, what effective configuration is stored in Kafka Producer/Consumer (including defaults). I do not see anthing explicit in java docs:

So, how to get back Kafka producer and consumer configuration?

1 Answers1

6

Unfortunately it's not possible. I have to admit it could be a useful feature for showing the "core" configuration properties at least (avoiding the possibility to get the "secrets" for authentication stuff for example). The only solution that I see today for you is to have a link between the consumer/producer instance and the related properties bag used for setting the client configuration. I understand it's a waste of memory because such configuration is internally in the client but you need to keep your properties bag for having it.

ppatierno
  • 9,431
  • 1
  • 30
  • 45
  • Thanks for the response. The problem with **my** config is that ist is mine :-), and could be detached from Producer/Consumer. If I have application server, where there are many beans, and they are using the same producer/consumer. There are questions: When producer was created, what configuration it has, was it created only one time, or there were overlapping "new KafkaProducer/Consumer"s. Of course in perfect software all is clear and done well. But sometimes I have bugs :-) and debbuging current config is hard, easier would be just to log config or prepare some validation functionality. – Seweryn Habdank-Wojewódzki Dec 06 '17 at 10:29
  • I have the same question @SewerynHabdank-Wojewódzki what did you end up doing? Currently I have a map keeping track of what config belongs to what producer. – Saher Ahwal Jul 22 '20 at 18:22
  • There are options to log complete Kafka configuration. Log4j2 config: – Seweryn Habdank-Wojewódzki Jul 29 '20 at 07:47