📢 This project is now fully documented in English.
For the original version in Spanish, switch to themain
branch.
Reactive microservice built with Spring WebFlux, Kafka, Redis, and MongoDB for real-time order processing and enrichment using external Go APIs.
- Project Overview
- Key Features
- Tech Stack
- Setup
- Run the Project
- Sample Payload
- Testing
- Scalability and Optimization
This project processes orders received through Kafka by enriching them with customer and product data via Go APIs. Orders are validated and stored in MongoDB. It also includes resilience mechanisms like retries and circuit breakers using Resilience4j.
- Reactive Kafka consumer with Spring WebFlux
- External data enrichment using Go APIs
- Redis for caching and distributed locks
- MongoDB for order persistence
- Retry and circuit breaker mechanisms with Resilience4j
- Java 21, Spring Boot 3.x, Spring WebFlux
- Apache Kafka – event streaming
- Redis – caching + locks
- MongoDB – order storage
- Go – mock APIs for customer and product enrichment
- Resilience4j, Reactor Retry
- JUnit 5, Mockito
- Docker (planned)
- Java 17+
- Maven
- Docker (Mongo, Redis, Kafka)
- Go
Update application.properties
:
spring.kafka.bootstrap-servers=localhost:9092
spring.data.mongodb.uri=mongodb://localhost:27017/pedidosDB
spring.data.redis.host=localhost
spring.data.redis.port=6379
- Start Kafka, Redis, MongoDB, and Go APIs
- Build and run the app:
mvn spring-boot:run
- Start Go APIs (from
/go-api
):
go run main.go
APIs:
GET /product
GET /customer
{
"orderId": "order-100",
"customerId": "Freyder-111",
"products": [
{
"productId": "product-100",
"name": "Iphone",
"price": 2000
}
]
}
Run tests with:
mvn test
Covered scenarios:
- Successful order processing
- Inactive client
- Product not found
- Redis lock handling
- MongoDB indexes: created on
orderId
andcustomerId
- Redis caching: reduces external API calls
- Retry & Circuit Breaker: for API resilience