Skip to content

Latest commit

 

History

History
74 lines (51 loc) · 2.66 KB

README.md

File metadata and controls

74 lines (51 loc) · 2.66 KB

Spring Boot Kafka Microservices

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.

Architecture Overview

  • 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.

Features

  • Event-driven architecture using Kafka for high-throughput data streams.
  • Asynchronous communication between microservices.
  • Real-time notifications for user-related events.

Technologies Used

  • Spring Boot
  • JDK 17
  • Apache Kafka
  • Spring Kafka
  • Postgresql
  • Couchbase
  • Docker

Getting Started

Prerequisites

  • JDK 17
  • Gradle
  • Docker

Setup

  1. Clone the repository:

    git clone <https://github.com/nihadamirov/spring-boot-kafka>
    cd spring-kafka-microservices
  2. Run Docker containers:

    docker-compose up
  3. Build the application:

    Navigate to each microservice directory (user-service, user-address-service, and notification-consumer) and run:

    ./gradlew build

Communication Flow

  1. User Service publishes events to Kafka when user actions occur.
  2. User Address Service consumes these events to manage user addresses accordingly.
  3. Notification Service consumes events to send notifications to users.
  4. Both User Address Service and Notification Service listen to the same Kafka topic, ensuring that both services can react to user creation events.

Additional Resources