Class KafkaProducer
java.lang.Object
callofproject.dev.authentication.config.kafka.KafkaProducer
Kafka producer.
-
Constructor Summary
ConstructorsConstructorDescriptionKafkaProducer
(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 TypeMethodDescriptionvoid
sendEmail
(callofproject.dev.data.common.dto.EmailTopic emailTopic) Send a message to the Kafka topic.void
sendMessage
(UserKafkaDTO message) Send a message to the Kafka topic.
-
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
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.
-