Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get back Kafka producer and consumer configuration (Java API)?

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:

  • KafkaProducer
  • KafkaConsumer

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

like image 326
Seweryn Habdank-Wojewódzki Avatar asked Dec 06 '17 09:12

Seweryn Habdank-Wojewódzki


People also ask

What is returned by a producer send () call in the Java API?

The send() method is asynchronous. When called it adds the record to a buffer of pending record sends and immediately returns. This allows the producer to batch together individual records for efficiency. The acks config controls the criteria under which requests are considered complete.

Is Kafka producer an API?

The Kafka Producer API allows applications to send streams of data to the Kafka cluster. The Kafka Consumer API allows applications to read streams of data from the cluster.


1 Answers

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.

like image 178
ppatierno Avatar answered Nov 14 '22 22:11

ppatierno