Skip to content

A proof-of-concept (POC) project demonstrating the integration of Apache Kafka with Spring Boot. This repository contains the essential configurations and setups for quickly bootstrapping a Spring Boot application with Kafka capabilities.

Notifications You must be signed in to change notification settings

MilaOrujaliyev/spring-kafka-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-kafka-poc

A proof-of-concept (POC) project demonstrating the integration of Apache Kafka with Spring Boot. This repository contains the essential configurations and setups for quickly bootstrapping a Spring Boot application with Kafka capabilities.

Spring Kafka POC

This repository provides a proof-of-concept (POC) for integrating Apache Kafka with Spring Boot. Using the provided Docker Compose setup, you can quickly bootstrap a Kafka cluster and send/receive messages using the simple Spring Boot service.

Getting Started

Prerequisites

  1. Docker and Docker Compose installed on your machine.
  2. Java 8+.
  3. Maven

Running the Project

1. Start the Kafka and Zookeeper services: docker-compose up -->This will start a Kafka broker and a Zookeeper instance using the provided docker-compose.yml configuration.

2. Run the Spring Boot application: mvn spring-boot:run

Once the application starts, it will connect to the Kafka broker running at localhost:29092.

3.Interacting with the Service You can send a message to the Kafka topic by making a POST request: POST /kafka/send Body: "Your message here" The received messages will be logged in the console of your Spring Boot application.

Code Overview KafkaProducer Service: A service that uses KafkaTemplate to send messages to a specified Kafka topic.

KafkaConsumer Service: A service that listens to a specified Kafka topic using the @KafkaListener annotation.

KafkaController: A REST controller that provides an endpoint for sending messages to Kafka.

curl command curl -X POST -H "Content-Type: application/json" -d '"Your message here"' http://localhost:8080/kafka/send

Postman Screenshot

image

About

A proof-of-concept (POC) project demonstrating the integration of Apache Kafka with Spring Boot. This repository contains the essential configurations and setups for quickly bootstrapping a Spring Boot application with Kafka capabilities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages