Spring Kafka offers a Spring Bean structure for Producing Kafka Messages. For someone familiar with using Kafka API, Spring Kafka can seem a bit different.
Here is a code snippet from Spring Kafka documentation showing the Classes involved in the Spring Kafka Producer.
We can see that there are 2 important classes involved. DefaultKafkaProducerFactory and KafkaTemplate. Here is a UML class diagram showing how they are related.
The KafkaTemplate bean needs an implementation ProducerFactory interface that has information to produce messages. There is only one implementation available - the DefaultKafkaProducerFactory class.
DefaultKafkaProducerFactory takes a Hashmap with properties like Kafka Server URLs, Serializer classes, etc.
Reference - https://docs.spring.io/spring-kafka/reference/htmlsingle/#_overview
Here is a code snippet from Spring Kafka documentation showing the Classes involved in the Spring Kafka Producer.
We can see that there are 2 important classes involved. DefaultKafkaProducerFactory and KafkaTemplate. Here is a UML class diagram showing how they are related.
The KafkaTemplate bean needs an implementation ProducerFactory interface that has information to produce messages. There is only one implementation available - the DefaultKafkaProducerFactory class.
DefaultKafkaProducerFactory takes a Hashmap with properties like Kafka Server URLs, Serializer classes, etc.
Reference - https://docs.spring.io/spring-kafka/reference/htmlsingle/#_overview