Java Microservices Architecture Development

Job ID: 39520027

Budget: ₹12,500 – ₹37,500 INR

# Mercurius – Microservices Architecture Overview

Mercurius is a microservices-based B2B platform developed to demonstrate a production-ready enterprise architecture using modern Java and Spring ecosystem technologies. The platform showcases secure, scalable, and event-driven service orchestration with service discovery, centralized authentication, reactive APIs, and asynchronous communication using RabbitMQ.

The architecture is modular and designed with real-world patterns including service registration, gateway routing, circuit breaking, reactive programming, and inter-service event publishing. The project was implemented by Hanuma Ramavath as part of an advanced backend system design and microservices portfolio.

## Key Components

### Authentication Service

Built with Keycloak and integrated with Spring Security (OAuth2), this service handles identity and access management. All microservices validate incoming requests using bearer tokens issued by Keycloak. It also supports token relay at the API Gateway level.

### API Gateway (BSyncOAuth)

Implemented using Spring Cloud Gateway. This component serves as the single entry point for all client requests. It performs request routing, security token relay, circuit breaking (Resilience4j), and retry logic. Custom filters are added for logging and redirect handling.

### Eureka Server

A central service registry for all microservices. It enables client-side service discovery and allows services to locate and communicate with each other by logical names.

### Account Service

Handles account creation and user subscription logic. Built using Spring WebFlux with functional routing and handlers. It stores account data in MongoDB and exposes reactive endpoints.

### Product Service

Manages product metadata and offers. It emits product creation events to RabbitMQ for further processing. It also listens for communication confirmation events to update product status.

### Eligibility Service

Calculates eligibility of users for specific products. It integrates with both the account and product services using Feign clients. Initially tested using hosted MySQL, later switched to an H2 database for development.

### Notification Service

Responsible for sending email confirmations and generating invoice PDFs. It listens to order and product-related events, processes the payload, and sends email notifications to users. It uses JavaMail and Apache PDFBox for content generation.

### Bridge Service

Originally created as a communication hub using Feign clients before the introduction of API Gateway. Now used primarily for demonstration and testing.

### Order Service

Handles order creation and cart item management. Publishes order confirmation messages and listens for updates from downstream services. Data is persisted using JPA with H2 or MySQL.

## Inter-Service Communication

* Product and Order services emit events to RabbitMQ queues.
* Notification service consumes events and sends confirmations.
* Eligibility service interacts with account and product services via Feign.
* Gateway acts as the gatekeeper and handles all authentication and routing.

## Technology Stack

* Spring Boot 3.x
* Spring Cloud Gateway
* Spring Cloud Eureka (Discovery Server)
* Spring Security OAuth2
* Spring WebFlux
* Spring Cloud Stream with RabbitMQ
* Spring Data JPA and MongoDB
* OpenFeign for declarative REST clients
* Keycloak (OIDC server)
* Docker (RabbitMQ, Keycloak deployment)

## Features Implemented

* Role-based authentication with token validation
* Centralized service discovery and routing
* Reactive endpoints for non-blocking I/O
* Event-driven architecture with messaging queues
* Circuit breaker and retry support with Resilience4j
* Metadata-based extensibility and attribute handling
* Email and PDF notification workflows
* Integration testing with local databases and mocked services

## Author

Hanuma Ramavath
Java Backend Developer | Spring Boot | Microservices | Cloud Native Java
GitHub: [https://github.com/netfreaker-ally](https://github.com/netfreaker-ally)

## Future Enhancements

* Integrate distributed tracing using Zipkin or ELK stack
* Add Redis support for session caching
* Containerize services with Docker Compose
* Implement API gateway rate-limiting and metrics
* Document APIs using OpenAPI (Swagger) specification