Class KafkaProducerConfig

java.lang.Object
api.mpba.rastvdmy.config.KafkaProducerConfig

@Configuration public class KafkaProducerConfig extends Object
This class is responsible for the configuration of Kafka producers. It provides the necessary beans for creating Kafka producers. The configuration properties are fetched from the application's properties file.
  • Constructor Details

    • KafkaProducerConfig

      public KafkaProducerConfig()
  • Method Details

    • producerConfig

      public Map<String,Object> producerConfig()
      This method provides the configuration for Kafka producers. It sets the bootstrap servers, key serializer and value serializer.
      Returns:
      A map containing the configuration properties.
    • producerFactory

      @Bean public org.springframework.kafka.core.ProducerFactory<String,String> producerFactory()
      This method provides a ProducerFactory bean. The ProducerFactory is responsible for creating Kafka producers.
      Returns:
      A new instance of DefaultKafkaProducerFactory.
    • kafkaTemplate

      @Bean public org.springframework.kafka.core.KafkaTemplate<String,String> kafkaTemplate(org.springframework.kafka.core.ProducerFactory<String,String> producerFactory)
      This method provides a KafkaTemplate bean. The KafkaTemplate wraps a Producer instance and provides convenience methods for sending messages to Kafka topics.
      Parameters:
      producerFactory - The producer factory.
      Returns:
      A new instance of KafkaTemplate.