https://github.com/hogwai/kafka-microservices
Microservices with Apache Kafka, Kafka Streams
https://github.com/hogwai/kafka-microservices
apache-kafka apache-zookeeper docker event-sourcing java kafka-streams microservices spring-boot
Last synced: 2 months ago
JSON representation
Microservices with Apache Kafka, Kafka Streams
- Host: GitHub
- URL: https://github.com/hogwai/kafka-microservices
- Owner: Hogwai
- License: mit
- Created: 2023-06-28T22:22:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-29T20:21:50.000Z (almost 3 years ago)
- Last Synced: 2025-03-21T01:41:32.106Z (about 1 year ago)
- Topics: apache-kafka, apache-zookeeper, docker, event-sourcing, java, kafka-streams, microservices, spring-boot
- Language: Java
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kafka-microservices
The project is composed of:
- A docker-compose running:
- Apache Zookeeper
- Apache Kafka
- [Kafdrop](https://github.com/obsidiandynamics/kafdrop)
- 3 microservices:
- producer
- consumer-producer
- consumer
## Prerequisites
- Docker
- JDK 17 and above
- Maven
## Description
### Producer
The entrypoint is the producer. It has an endpoint available for orders creation.
#### Payload
Here is an example of the required payload:
```
curl --location 'http://localhost:8080/order' \
--header 'Content-Type: application/json' \
--data '{
"item": "pizza",
"amount": "15",
"vat": 19.6
}'
```
### Consumer-producer
This microservice listens to events emitted on the producer topic.
Its purpose is to apply VAT on food orders, then to emit the updated order on the consumer-producer topic.
It uses Kafka Streams.
### Consumer
This microservice listens to events emitted on the consumer-producer topic.
Its purpose is to save food orders in database.
## Installation
Clone the project on your local machine.
Launch Zookeeper, Kafka and Kafdrop:
```
docker compose up
```
Launch the microservices:
```
mvn spring-boot:run
```