How sebs210/prueba-detsu works
Main Components
• Microservice Cliente:
• Serves CRUD operations for “Cliente” and “Persona”.
• Contains layers for configuration (e.g. RabbitMQConfig), controller (ClienteController), domain (Cliente and Persona), repository, and service (ClienteMessageSender).
• Connects to its own PostgreSQL instance (“cliente_db” as defined in the BaseDatos.sql and docker-compose).
• Microservice Cuenta:
• Manages “Cuenta” and “Movimiento” including CRUD operations, report generation, and error handling.
• Contains similar layers (configuration with its RabbitMQConfig, controllers such as CuentaController and MovimientoController, domain objects, DTOs, repository, service with a message listener for asynchronous account creation).
• Uses a separate PostgreSQL instance (“cuenta_db”).
• RabbitMQ:
• Acts as the intermediary for asynchronous communication. When a client is created in microservice-cliente, a message is sent to microservice-cuenta to automatically initialize an account.
• Databases:
• Two PostgreSQL databases (one for each microservice).
• Docker and Docker Compose:
• The overall deployment mechanism tying together the microservices, databases, and RabbitMQ.
Relationships and Interactions
• Microservice-cliente sends an asynchronous message via RabbitMQ every time a new client is created.
• Microservice-cuenta listens for these messages (using its message listener) and then creates a corresponding bank account.
• Both services expose RESTful endpoints (different ports: 8081 for cliente, 8082 for cuenta) and interact with their own databases.
• Docker Compose orchestrates the startup order and network connectivity among the two services, RabbitMQ server, and the PostgreSQL containers.
Architectural Patterns and Design Principles
• Microservices Architecture: The project is naturally split into independent services that work together.
• Asynchronous Messaging: RabbitMQ is used to decouple operations (client creation triggers account creation asynchronously).
• Layered (N-tier) design: Each service separates concerns (controller, service, repository, configuration, domain) which is typical in Spring Boot applications.
• Containerization: Docker and Docker Compose simplify deployment and simulate production-like environments.
Relevant Technologies
• Backend: Spring Boot (Java 17)
• Databases: PostgreSQL (version 15)
• Messaging: RabbitMQ (version 3)
• Build Tool: Maven (with supporting wrapper scripts)
• Testing: JUnit 5, Integration tests inside the respective microservice folders
• Deployment: Docker and Docker Compose
Elements
• Each container/component should be clearly labeled (e.g., “Microservice Cliente”, “Microservice Cuenta”, “RabbitMQ Broker”, “PostgreSQL for Cliente”, “PostgreSQL for Cuenta”).
• HTTP request flows between external consumers and each service.
• The message flow from microservice-cliente to microservice-cuenta via RabbitMQ.
• Data access flows between microservices and their particular PostgreSQL database.