A microservices-based event booking platform built with Java, Spring Boot, Spring Cloud, Redis, and MySQL. The project focuses on reliable event booking, concurrent seat management, caching, distributed locking, and inter-service communication.
- Event CRUD operations
- Seat reservation and release
- Booking and cancellation workflows
- Optimistic locking for concurrent booking requests
- Redis caching
- Redis cache eviction
- Distributed locking with Redisson
- Inter-service communication
- Compensating rollback for failed booking workflows
- Service discovery with Eureka
- Centralized configuration with Spring Cloud Config Server
- API Gateway for request routing
- Unit testing for core services
Client
|
v
+--------------+
| API Gateway |
+--------------+
|
+------------+------------+
| |
v v
+-------------+ +--------------+
| Event |<----------| Booking |
| Service | | Service |
+-------------+ +--------------+
| |
v v
+--------+ +--------+
| MySQL | | MySQL |
+--------+ +--------+
|
v
+--------+
| Redis |
+--------+
+------------------+ +------------------+
| Eureka Server | | Config Server |
| Service Discovery| | Central Config |
+------------------+ +------------------+
Responsible for:
- Creating events
- Updating events
- Retrieving events
- Deleting events
- Managing event seats
- Reserving seats
- Releasing seats
Responsible for:
- Creating bookings
- Communicating with Event Service
- Booking cancellation
- Handling booking failures
- Compensating rollback
Provides service discovery so that microservices can locate and communicate with each other.
Provides centralized configuration for the microservices.
Acts as the entry point for client requests and routes requests to the appropriate microservice.
- Language: Java
- Backend: Spring Boot
- Architecture: Microservices
- Cloud: Spring Cloud
- Service Discovery: Eureka
- Configuration: Spring Cloud Config Server
- Gateway: Spring Cloud Gateway
- Caching: Redis
- Distributed Locking: Redisson
- Database: MySQL
- Testing: JUnit
- Build Tool: Maven
The project uses optimistic locking to prevent conflicting updates when multiple users attempt to reserve seats simultaneously.
Redisson distributed locking is used to coordinate concurrent operations and prevent multiple service instances from performing conflicting booking operations.
Booking Request
|
v
Acquire Distributed Lock
|
v
Check Seat Availability
|
v
Reserve Seat
|
v
Release Lock
Redis is used to cache event data and reduce repeated database queries.
When event data changes, the corresponding cache entry is evicted to prevent stale data.
Request
|
v
Redis Cache
|
+---- Cache Hit ----> Return Data
|
+---- Cache Miss ---> MySQL
|
v
Store in Redis
The booking workflow uses a compensating rollback mechanism to maintain consistency when a booking operation fails after a seat has already been reserved.
Create Booking
|
v
Reserve Seat
|
v
Continue Booking
|
+--+--+
| |
Success Failure
| |
v v
Complete Release Seat
|
v
Rollback
- CRUD operations
- Seat reservation and release
- Optimistic locking
- Unit tests
- Inter-service communication
- Compensating rollback
- Booking cancellation
- Eureka Service Registry
- Config Server
- API Gateway
- End-to-end routing
- Redis caching
- Cache eviction
- Redisson distributed locking
- Lock/unlock verification
- Java 21+
- Maven
- MySQL
- Redis
git clone https://github.com/YOUR_USERNAME/event-booking-microservices.git
cd event-booking-microservicesStart the services in the following order:
- Config Server
- Eureka Server
- Event Service
- Booking Service
- API Gateway
Then send requests through the API Gateway.
event-booking-microservices/
├── event-service/
├── booking-service/
├── config-server/
├── api-gateway/
├── service-registry/
├── config-repo/
├── .gitignore
└── README.md
- JWT authentication and authorization
- Kafka/RabbitMQ for asynchronous communication
- Resilience4j circuit breaker
- Docker containerization
- Centralized logging
- Application monitoring
Raju Chowdhury
Java Backend Developer
Java | Spring Boot | Microservices | Spring Cloud | Redis