This project is a Spring Boot application that utilizes Apache Kafka for asynchronous messaging between services. The architecture consists of two microservices: User Service and User Address Service, which communicate through Kafka topics. Additionally, there is a Notification Service that listens for events and sends notifications accordingly.
- User Service: Manages user-related operations and sends user events to Kafka topics.
- User Address Service: Consumes user events from Kafka topics to manage user addresses.
- Notification Service: Consumes events from Kafka topics to send notifications based on user actions.
Both the User Address Service and Notification Service listen to the same Kafka topic, allowing them to respond to user creation events in real-time.
- Event-driven architecture using Kafka for high-throughput data streams.
- Asynchronous communication between microservices.
- Real-time notifications for user-related events.
- Spring Boot
- JDK 17
- Apache Kafka
- Spring Kafka
- Postgresql
- Couchbase
- Docker
- JDK 17
- Gradle
- Docker
-
Clone the repository:
git clone <https://github.com/nihadamirov/spring-boot-kafka> cd spring-kafka-microservices
-
Run Docker containers:
docker-compose up
-
Build the application:
Navigate to each microservice directory (
user-service
,user-address-service
, andnotification-consumer
) and run:./gradlew build
- User Service publishes events to Kafka when user actions occur.
- User Address Service consumes these events to manage user addresses accordingly.
- Notification Service consumes events to send notifications to users.
- Both User Address Service and Notification Service listen to the same Kafka topic, ensuring that both services can react to user creation events.