where should I get missing properties for creating the Kafka producer?

39 Views Asked by At

Could you explain where should I get missing properties in the following code?
(smth should be in the lsat line)

KafkaProperties prop = new KafkaProperties();
KafkaProperties.Producer producer = prop.getProducer();
producer.setBootstrapServers(List.of(kafkaIP));
producer.setValueSerializer(JsonSerializer.class);
return producer.buildProperties(<smth should be here>);
1

There are 1 best solutions below

0
OneCricketeer On

This object is not meant to be used directly.

You should do this in your Boot config file, not code unless you use a KafkaTemplate and a Factory bean for it.

See https://docs.spring.io/spring-boot/docs/current/reference/html/messaging.html#messaging.kafka

Regarding what you can configure, see Kafka documentation itself.