Write a Kafka producer with Java using Spring Boot

Roberto Pozzi
7 min readMay 5, 2023

Sometime ago I set up my Raspberry board with a temperature and humidity sensor and configured it to publish data to a Kafka cluster (you can read the 2-article series starting from the first article here https://medium.com/@robertopozzi/using-sensors-with-raspberry-boards-part-1-sending-data-to-kafka-8b7a545949f9).

The component to read sensor data and send it to a Kafka topic was a Kafka producer written in Python; since Kafka, by nature, is agnostic about the technology you use to interact with it, in this article I want to use Java…

--

--

Roberto Pozzi

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