All projectsGET /projects/booking-inventory-flow

Booking and inventory flow

How a booking reserves a room and keeps inventory consistent across services.

Type
Work
Role
Backend developer, Booking Service and Room Inventory
Status
Shipped
When
2023 to present
  • Java 17
  • Spring Boot
  • Kafka
  • Redis
  • MySQL
  • Spring Data JPA

Problem

Availability had to stay correct while many guests searched and booked the same rooms, without every search hitting the database.

Approach

  1. Booking Service validates the request and checks availability before confirming.
  2. Booking events are published to Kafka so Room Inventory updates asynchronously.
  3. Room availability is cached in Redis and refreshed when inventory events arrive.
  4. Notification Service consumes the same events to send confirmations.
diagram: booking-inventory-flow

Architecture

Architecture map10 components · 9 connections
55%
client Angular client service API Gateway service Booking Service queue Kafka service Room Inventory service Notification Service cache Redis database MySQL external SendGrid external Twilio HTTPSRESTbooking eventconsumeconsumecacheJPAemailSMS

Fit shows the whole map. Zoom in, then drag or scroll to explore.

Connections

  • Angular client to API GatewayHTTPS
  • API Gateway to Booking ServiceREST
  • Booking Service to Kafkabooking event
  • Kafka to Room Inventoryconsume
  • Kafka to Notification Serviceconsume
  • Room Inventory to Rediscache
  • Room Inventory to MySQLJPA
  • Notification Service to SendGridemail
  • Notification Service to TwilioSMS