20 lines
474 B
Java
20 lines
474 B
Java
package com.myapps.kafka.producer;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.kafka.core.KafkaTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@Service
|
|
public class KafkaProducerService {
|
|
|
|
private static final String TOPIC = "alertas-raw";
|
|
|
|
@Autowired
|
|
private KafkaTemplate<String, String> kafkaTemplate;
|
|
|
|
public void sendMessage(String message) {
|
|
kafkaTemplate.send(TOPIC, message);
|
|
}
|
|
}
|
|
|