Implementation of a simple ticket service that facilitates the discovery, temporary hold, and final reservation of seats within a high-demand performance venue.
This application is developed using Spring Boot, Spring JDBC, Spring RESTful web services, Maven, HSQLDB.
- Users are provided seats based on the availability.
- No seat numbers.
- Hold time for the seats is 60 seconds. If the user doesn't reserve the seats before 60 seconds, then the holds are removed and user has to send a request again to hold the seats.
- No notification for the expiration of seat holds.
- User can hold and reserve the seats at multiple levels by providing the minLevel and maxLevel.
-
Clone the project
git clone https://github.com/vamshins/ticket-booking-service.git -
Kindly make sure JAVA_HOME environment variable is configured and maven bin directory is added to PATH environment variable. Run the following commands
cd ticket-booking-servicemvn packagecd targetjava -jar ticket-booking-service-0.0.1-SNAPSHOT.jarAfter running the above commands successfully, you should see the following messages.
.... Tomcat started on port(s): 8080 (http) .... Started TicketBookingServiceApplication in 8.837 seconds (JVM running for 9.214)
-
Find the number of seats available within the venue, optionally by seating level Note: available seats are seats that are neither held nor reserved.
-
Find and hold the best available seats on behalf of a customer, potentially limited to specific levels Note: each ticket hold should expire within a set number of seconds.
POST - http://localhost:8080/ticket-booking-service/v1/venue/seats/holdRequestBody:
{ "numSeats": "6250", "customerEmail": "vamshi.krishna588@gmail.com", "minLevel": "1", "maxLevel": "4" }ResponseEntity:
{ "id": 1, "customerEmail": "vamshi.krishna588@gmail.com", "seatHoldVenueDetailList": [ { "level": 1, "numberOfSeatHolds": 1250 }, { "level": 2, "numberOfSeatHolds": 2000 }, { "level": 3, "numberOfSeatHolds": 1500 }, { "level": 4, "numberOfSeatHolds": 1500 } ] }This request will expire after 60 seconds. Before that, user has to reserve the seats using the web service in the following request.
-
Reserve and commit a specific group of held seats for a customer
POST - http://localhost:8080/ticket-booking-service/v1/venue/seats/reserveRequestBody:
{ "seatHoldId": "1", "customerEmail": "vamshi.krishna588@gmail.com" }ResponseEntity:
{ "seatHoldId": 1, "customerEmail": "vamshi.krishna588@gmail.com", "confirmationCode": "0879edae-2dd3-4c59-9df3-604edc5a4623" }
Tests are done using JUnit. Tests are run using the command
mvn test
The application is designed using HSQLDB. For illustration purposes, I have generated the schema design using MySQL Workbench.
The following diagram shows the request and response flow of holding the seats.