Write a Kafka consumer with Java using Spring Boot

Roberto Pozzi
5 min readMay 15, 2023

Recently I wrote the article Write a Kafka producer with Java using Spring Boot; the other side of the coin in an event streaming platform like Kafka is clearly a consumer, a component that consumes and acts on the messages the producer has published to a Kafka topic.

Building on the first article, I also used Spring Boot (https://docs.spring.io/spring-boot/docs/3.1.0-SNAPSHOT/reference/html/index.html) to develop a simple Java based Kafka consumer which reads temperature and humidity data from a Kafka topic:

--

--

Roberto Pozzi

Roberto works as Cloud Architect, specialized in cloud native and container based architectures.