How hzeroxium/spring-petclinic-microservices works
Core Components
• API Gateway: Represented by the “spring-petclinic-api-gateway” module, this component acts as the front door for client requests, handling routing, load balancing, circuit breaking (with Resilience4j), and fallback logic.
• Service Discovery: Mark the “spring-petclinic-discovery-server” which registers all microservices (Customers, Vets, Visits, GenAI, etc.) making them discoverable.
• Config Server: Show the “spring-petclinic-config-server” which centralizes configuration management for all services.
• Business Services:
• Customers Service: Handles customer data and related operations.
• Vets Service: Manages veterinarian information.
• Visits Service: Deals with pet visit records.
• GenAI Service: Adds artificial intelligence/chatbot capabilities for natural language interactions.
• Spring Petclinic Admin Server: Provides administrative and monitoring capabilities.
• External/Supporting Components:
• Monitoring & Metrics: Include Grafana and Prometheus containers (their Docker files and configurations are provided in the “docker” directory).
• Database: Indicate that each service (such as Customers, Vets, Visits) can use either an in-memory HSQLDB or a MySQL instance based on the active profile.
• CI/CD & Deployment: Optionally include Jenkins pipelines (Jenkinsfile) and Docker Compose orchestration that tie the system together.
• Chaos Monkey/Resilience Testing: Represent the “scripts/chaos” utilities used for fault injection.
Relationships and Data Flows
• From the API Gateway, illustrate request routing to each microservice.
• Dependencies with the database for data persistence.
Architectural Patterns and Design Principles
• Microservices Architecture: Emphasize the decoupled services each running in separate containers or pods, with their own codebases and data management strategies.
• API Gateway pattern: Centralize request handling, facilitate cross-cutting concerns such as circuit breaking, rate limiting and security.
• Service Discovery and Config Management: Highlight the usage of Eureka and Spring Cloud Config.
• Resilience Patterns: Indicate aspects like circuit breakers (as seen in the API Gateway’s fallback methods) and Chaos Monkey experiments for testing failure resilience.
• Containerization: Include Docker Compose orchestration and Dockerfiles for individual services to denote containerized deployment across platforms (both Docker and Podman are supported).
Specify Technologies and Frameworks
• Java 17 & Spring Boot for the microservices
• Spring Cloud, including Eureka, Cloud Gateway, Cloud Config, and Circuit Breaker (Resilience4j)
• Docker (with docker-compose) for container orchestration
• Grafana and Prometheus for monitoring and metrics gathering
• Maven for building and managing dependencies
• Jenkins for CI/CD processes
• Optional Chaos Monkey scripts for resilience testing