Producer and Consumer Applications Using Spring Kafka

In this lesson, we will learn to use Kafka with a Spring Boot application with the help of a couple of additional applications.

Producer application

In this section, we will use the KafkaTemplate API in a Spring Boot application to send messages to Kafka. The application consists of a REST endpoint using Spring Boot web with the spring-boot-starter-web module. The application will be packaged as a JAR file, but run as a self-contained HTTP server by using an embedded Tomcat server.

Click the “Run“ button in the widget below. This will initiate the build process and start the application. Once the application has started, you should see the Started SpringKafkaProducerApplication message.


After that, follow the steps outlined below:

Get hands-on with 1200+ tech skills courses.