Task 1
Each service should handle a specific business function, enabling independent deployment.
Here’s a breakdown of how we could structure this system:
1. Microservices Overview
• Reservation Service.
• Payment Service
• Room Availability Service
2. Service Responsibilities
• Reservation Service:
o Manages room booking requests: checking availability, creating new
reservations, and updating existing bookings
o Communicates with the Room Availability Service to confirm room
availability.
o Communicates with the Payment Service to handle pre-payment verification
and post-payment confirmation for bookings.
• Payment Service:
o Manages transaction processing
o Payment gateways
o Confirming payments, such as sending payment confirmation to the
Reservation Service.
• Room Availability Service:
o Manages room statuses
o Updates availability information based on the booking status
o Ensures the Reservation Service has access to real-time room availability.
3. Communication
• Asynchronous Messaging: Services can use asynchronous communication via a
message broker for event-driven updates. For instance:
o When a reservation is made, the Reservation Service publishes an event that
the Room Availability Service consumes to update room status.
• Synchronous Communication: Services requiring immediate responses (e.g.,
Payment) could use synchronous API calls between services.
Task 2
Payment Service
1. Data Managed:
o Transaction Records: Stores details of each transaction, such as payment
status, amount, date, and a unique transaction ID.
2. Data Sharing:
o Read-Only:
Reads the reservation status from the Reservation Service (e.g., to
verify that a room is temporarily held before processing a payment).
o Update:
Updates only its own transaction records.
Notifies the Reservation Service of the payment outcome (success or
failure) to confirm or release the reservation.
Room Availability Service
1. Data Managed:
o Room Status: Tracks each room’s availability, current status (e.g., available,
reserved, occupied, maintenance requiring).
o Room Configuration: Stores details about each room’s type, capacity, and
features (e.g., deluxe, suite).
2. Data Sharing:
o Read-Only:
Allows the Reservation Service to read room availability information
to confirm room status during booking creation or modification.
o Update:
Updates only its own room status data.
Listens to reservation-related updates from the Reservation Service to
update room availability in response to bookings or cancellations.