Class KafkaProducer

java.lang.Object
callofproject.dev.authentication.config.kafka.KafkaProducer

@Service public class KafkaProducer extends Object
Kafka producer.
  • Constructor Summary

    Constructors
    Constructor
    Description
    KafkaProducer(org.apache.kafka.clients.admin.NewTopic topic, org.apache.kafka.clients.admin.NewTopic emailTopic, org.springframework.kafka.core.KafkaTemplate<String,UserKafkaDTO> kafkaTemplate, org.springframework.kafka.core.KafkaTemplate<String,callofproject.dev.data.common.dto.EmailTopic> emailKafkaTemplate)
    Constructor for the KafkaProducer class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    sendEmail(callofproject.dev.data.common.dto.EmailTopic emailTopic)
    Send a message to the Kafka topic.
    void
    Send a message to the Kafka topic.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KafkaProducer

      public KafkaProducer(org.apache.kafka.clients.admin.NewTopic topic, @Qualifier("emailTopic") org.apache.kafka.clients.admin.NewTopic emailTopic, org.springframework.kafka.core.KafkaTemplate<String,UserKafkaDTO> kafkaTemplate, org.springframework.kafka.core.KafkaTemplate<String,callofproject.dev.data.common.dto.EmailTopic> emailKafkaTemplate)
      Constructor for the KafkaProducer class. It is used to inject dependencies into the service.
      Parameters:
      topic - The NewTopic object to be injected.
      emailTopic - The NewTopic object to be injected.
      kafkaTemplate - The KafkaTemplate object to be injected.
      emailKafkaTemplate - The KafkaTemplate object to be injected.
  • Method Details

    • sendMessage

      public void sendMessage(UserKafkaDTO message)
      Send a message to the Kafka topic.
      Parameters:
      message - The message to send.
    • sendEmail

      public void sendEmail(callofproject.dev.data.common.dto.EmailTopic emailTopic)
      Send a message to the Kafka topic.
      Parameters:
      emailTopic - The message to send.