Basic implementation of a Kafka producer and consumer, using Spring Boot and Spring Kafka.
The app expects a Kafka broker to be running on the default port. If you don´t want to install Kafka locally, probably the fastest way to get it running is using Conduktor. You can download it from here https://www.conduktor.io/download and quickly start a single instance Kafka cluster.
Execute:
curl --request POST
--url http://localhost:8080/produce/foo
This will send a message to the topic using the KafkaTemplate class (part of Spring Kafka Project)
Execute:
curl --request GET
--url http://localhost:8080/consumer/messages
This will return all messages read by a consumer subscribed to the topic, using a consumer created with the annotation @KafkaListener (part of Spring Kafka Project)