Skip to content

This project uses Event-Driven Architecture with Java 17, Spring Boot 3 and Kafka. Two microservices were created, ms-kafka-producer and ms-kafka-consumer. Both communicate with Kafka through Spring Boot to create and access topics and partitions.

Notifications You must be signed in to change notification settings

jonasfschuh/kafka-spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kafka Spring - Event-Driven Architecture

Java Spring Apache Kafka Docker IntelliJ IDEA Postman

This project uses Event-Driven Architecture with Java 17, Spring Boot 3 and Kafka.

Two microservices were created, ms-kafka-producer and ms-kafka-consumer. Both communicate with Kafka through Spring Boot to create and access topics and partitions.

Table of Contents

Installation

  1. Clone the repository:
git clone https://github.com/jonasfschuh/kafka-spring.git
  1. Install dependencies with Maven

  2. Install Docker

  3. Install Offset Explorer

  4. Install Postman

Usage

  1. Start docker containers, through the Docker folder
docker-compose up

To stop docker containers, use:

docker-compose down
  1. Configure Offset Explorer for Kafka (9092) and Zookeeper (2181) ports.

Note: Kakfa can be accessed directly via IntelliJ

  1. Start the application ms-kafka-producer with Maven or through the Services tab in intelliJ.
  2. The producer API will be accessible at http://localhost:8080/
  3. Access Postman and post a request.

Example

{
    "code": "2008", 
    "productName": "Toyota Camry XLE V6",
    "value": "60000.00"
}
  1. Start the application ms-kafka-consumer with Maven or through the Services tab in intelliJ.

API Endpoints

The API provides the following endpoints:

POST /api/save-order - Register an event in Kafka. In this case, a purchase order.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the repository.

When contributing to this project, please follow the existing code style, commit conventions, and submit your changes in a separate branch.

Screenshots

Starting containers

Starting ms-producer

Offset explorer

Postman

Ms-kafka-consumer - details

Offset explorer - details

About

This project uses Event-Driven Architecture with Java 17, Spring Boot 3 and Kafka. Two microservices were created, ms-kafka-producer and ms-kafka-consumer. Both communicate with Kafka through Spring Boot to create and access topics and partitions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published