Saga orchestration microservice for xshopai - implements choreography-based saga pattern for distributed order processing transactions across payment, inventory, and shipping services.
- Java 21+ (Download)
- Maven 3.9+ (Install Guide)
- PostgreSQL 12+ (Download)
- Dapr CLI 1.16+ (Install Guide)
1. Start PostgreSQL
# Using Docker (recommended)
docker run -d --name order-processor-postgres -p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=order_processor_db \
postgres:12
# Or install PostgreSQL locally2. Clone & Build
git clone https://github.com/xshopai/order-processor-service.git
cd order-processor-service
mvn clean install3. Configure Environment
# Edit application.properties or create application-dev.properties
# spring.datasource.url=jdbc:postgresql://localhost:5432/order_processor_db
# spring.datasource.username=postgres
# spring.datasource.password=postgres4. Initialize Dapr
# First time only
dapr init5. Run Service
# Start with Dapr (recommended)
./run.sh # Linux/Mac
.\run.ps1 # Windows
# Or run directly
mvn spring-boot:run6. Verify
# Check health
curl http://localhost:8080/actuator/health
# Should return: {"status":"UP"...}# Run tests
mvn test
# Build package
mvn clean package
# Run with profile
mvn spring-boot:run -Dspring-boot.run.profiles=dev
# Skip tests
mvn clean install -DskipTests| Document | Description |
|---|---|
| 📖 Developer Guide | Local setup, debugging, daily workflows |
| 📘 Technical Reference | Architecture, security, monitoring |
| 🤝 Contributing | Contribution guidelines and workflow |
API Documentation: See .dapr/README.md for Dapr configuration and src/main/java/com/xshopai/orderprocessor/ for endpoint definitions.
# Service
SPRING_PROFILES_ACTIVE=development
SERVER_PORT=8080
# Database
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/order_processor_db
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=postgres
# JWT
JWT_SECRET=your-secret-key-min-32-characters
# Dapr
DAPR_HTTP_PORT=3510
DAPR_GRPC_PORT=50010
DAPR_APP_ID=order-processor-serviceSee application.properties for complete configuration options.
- Choreography-based saga pattern
- Distributed transaction coordination
- Event sourcing for order processing
- Compensation logic for failed transactions
- Integration with payment, inventory, and shipping services
- Idempotency and retry mechanisms
- Comprehensive event logging
- Spring Boot 3.x with Java 21
Saga Orchestration Pattern:
Order Created → Payment → Inventory → Shipping → Order Completed
↓ ↓ ↓
Compensate Compensate Compensate (on failure)
- Implements choreography pattern (event-driven)
- Each service publishes events, processor orchestrates
- Automatic compensation on failure
- Eventually consistent transactions
- order-service - Order management
- payment-service - Payment processing
- inventory-service - Inventory management
MIT License - see LICENSE
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: docs/