Skip to content

Kafka producer and consumer, using Spring Boot and Spring Kafka

Notifications You must be signed in to change notification settings

martin-mazzini/kafka-spring-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Kafka with Spring Boot

Basic implementation of a Kafka producer and consumer, using Spring Boot and Spring Kafka.

Launch the project

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.

image

Send a message

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)

Read a message

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)

About

Kafka producer and consumer, using Spring Boot and Spring Kafka

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages