Created
October 25, 2022 12:40
-
-
Save kirshiyin89/4f4c94d744c19ae66e2afbce82c260c1 to your computer and use it in GitHub Desktop.
produce messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequiredArgsConstructor | |
@Slf4j | |
public class ProducerController { | |
private final KafkaTemplate<String, String> kafkaTemplate; | |
@Value("${topic}") | |
private String topic; | |
@GetMapping("/produce/{message}") | |
public void produceMessage(@PathVariable("message") final String message) { | |
kafkaTemplate.send(topic, message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment