How olantobi/ride-booking-service works
• booking-producer-service (the Producer microservice)
• booking-consumer-service (the Consumer microservice)
• booking-service-contract (shared service contract containing DTOs)
And Clearly Separate the Main Components
• Producer Microservice:
• Contains the REST API endpoints (BookingController, Swagger config, global exception handling).
• Runs on port 8080.
• Responsible for receiving booking requests and publishing booking messages.
• Contains configuration for interacting with a message broker (via RabbitMQ configurations in its config package).
• Consumer Microservice:
• Listens for incoming booking messages through a message queue.
• Runs on port 8100.
• Uses JPA configuration (JpaConfig) to interact with a persistence storage (database) and handles business logic like auditing (AuditService, PrintAuditService).
• Service Contract Module:
• Defines shared Data Transfer Objects (DTOs) like BookingDto, ErrorDto, MessageWrapper, etc.
• Provides a common interface so that both microservices adhere to the same data contracts.
• Cross-cutting Elements:
• Externalized configuration via application.yml in the parent project, ensuring consistent configuration across microservices.
• Usage of RabbitMQ as the message broker connecting the producer and consumer services.
• Maven build structure and dependencies (the .mvn wrapper and pom.xml files) that provide module management and build configuration.
Interactions and Data Flow
• An external client (or user interface / API consumer) sending booking requests to the Producer service (running on port 8080).
• The Producer microservice processes these requests and, using its messaging service (e.g., MessagingService, RQueueMessagingService), publishes messages to a RabbitMQ exchange/queue.
• The Consumer microservice, configured with RabbitMqConfig, listens on that same queue for incoming messages.
• Upon receiving a message, the Consumer service processes it, persists booking information (via BookingRepository) possibly in a database, and may perform additional tasks like logging/auditing using AuditService.
• Both microservices use the shared DTOs from the Service Contract module for unified data representation.
Architectural Patterns and Principles
• Microservices Architecture: Two independent, interconnected services that communicate asynchronously via a message broker.
• API Gateway/Controller Pattern: The Producer service exposes REST endpoints.
• Messaging/Queue-based Integration: Using RabbitMQ as the intermediary to decouple the services.
• Shared Contract Pattern: The Service Contract module ensures both services use the same data models, reducing integration errors.
• Configuration Management: Externalized configuration with a common application.yml file ensures consistent settings between services.
Relevant Technologies and Frameworks
• Spring Boot (implied by the structure and naming conventions in Java packages)
• RabbitMQ (seen by the multiple RabbitMqConfig classes in both services)
• JPA for persistence (JpaConfig & BookingRepository)
• Maven for project management (pom.xml files, mvnw scripts)
• Swagger (for API documentation in the producer service)
• Possibly Orika for object mapping (in the consumer service’s utils package)
Essential Architectural Elements
• Every element listed above is included and clearly labeled.
• Integration points like the RabbitMQ message broker and the shared DTO contract module.
• Be detailed in indicating the ports used for each microservice and the primary configuration files they rely on.