Event Ticketing System with Producer-Consumer Pattern
Built with the following tools and technologies:
This Real-Time Event Ticketing System employs the Producer-Consumer model along with multi-threading to manage simultaneous vendor ticket releases and customer purchases. It's an ideal solution for overseeing high-demand events where ticketing needs arise concurrently, as it maintains data integrity in a dynamic, real-time environment and provides essential reporting capabilities.
This system demonstrates its proficiency in utilizing multithreading to address multiple requests simultaneously. The system's real-time updates and basic logging capabilities make it an excellent choice for managing ticket sales and availability. The system's web interface provides a user-friendly experience, allowing users to monitor ticket availability and transactions in real-time.
- *Concurrency Management*: Simultaneous handling of ticket releases and purchases.
- *Data Integrity*: Thread-safe operations using synchronization for consistent ticket availability.
- *Multi-threaded Environment*: Employs producer-consumer threading to manage multiple vendors and customers.
- *Real-Time Updates*: Provides a UI with real-time status on ticket availability and transactions.
- *Basic Logging*: Tracks and records system activities for audit and troubleshooting.
- *Polling Usage*: Utilizes Periodic Polling for real-time updates.
- *API Usage*: Connects front end and backend using APIs.
└── ticketing-system/
├── README.md
│── systemConfiguration.json
├── backend
│ ├── .gitattributes
│ ├── .gitignore
│ ├── .mvn
│ ├── Dockerfile
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ ├── src
│ │ └── main
│ │ ├── controller
│ │ │ ├── CustomerController.java
│ │ │ ├── VendorController.java
│ │ │ ├── ConfigController.java
│ │ │ ├── LogController.java
│ │ │ └── SystemController.java
│ │ ├── model
│ │ │ ├── SystemConfiguration.java
│ │ │ ├── Customer.java
│ │ │ ├── Vendor.java
│ │ │ ├── Ticket.java
│ │ │ └── Log.java
│ │ ├── repository
│ │ │ ├── CustomerRepository.java
│ │ │ ├── LogRepository.java
│ │ │ ├── SystemConfigRepository.java
│ │ │ └── VendorRepository.java
│ │ ├── service
│ │ │ ├── impl
│ │ │ │ ├── ConfigServiceImpl.java
│ │ │ │ ├── CustomerServiceImpl.java
│ │ │ │ ├── VendorServiceImpl.java
│ │ │ │ ├── TicketPoolServiceImpl.java
│ │ │ │ ├── SystemServiceImpl.java
│ │ │ │ └── LogServiceImpl.java
│ │ │ ├── runnable
│ │ │ │ ├── CustomerRunnable.java
│ │ │ │ └── VendorRunnable.java
│ │ │ ├── ConfigService.java
│ │ │ ├── CustomerService.java
│ │ │ ├── SystemService.java
│ │ │ ├── TicketPoolService.java
│ │ │ ├── VendorService.java
│ │ │ └── LogService.java
│ │ └──TicketingSystemBackendApplication.java
│ └── resources
│ ├── application.properties
│ ├── log4j2.properties
│ └── system.log
└── frontend
├── .angular
├── .editorconfig
├── .gitignore
├── README.md
├── angular.json
├── desktop.ini
├── package-lock.json
├── package.json
├── postcss.config.js
├── public
├── src
├── tsconfig.app.json
├── tsconfig.json
└── tsconfig.spec.json
├── src
│ └── app
│ ├── components
│ │ ├── configuration-form
│ │ │ ├── configuration-form.component.css
│ │ │ ├── configuration-form.component.html
│ │ │ ├── configuration-form.component.spec.ts
│ │ │ └── configuration-form.component.ts
│ │ ├── control-panel
│ │ │ ├── control-panel.component.css
│ │ │ ├── control-panel.component.html
│ │ │ ├── control-panel.component.spec.ts
│ │ │ └── control-panel.component.ts
│ │ ├── count-display
│ │ │ ├── count-display.component.css
│ │ │ ├── count-display.component.html
│ │ │ ├── count-display.component.spec.ts
│ │ │ └── count-display.component.ts
│ │ ├── line-chart
│ │ │ ├── line-chart.component.css
│ │ │ ├── line-chartm.component.html
│ │ │ ├── line-chart.component.spec.ts
│ │ │ └── line-chart.component.ts
│ │ ├── log-display
│ │ │ ├── log-display.component.css
│ │ │ ├── log-display.component.html
│ │ │ ├── log-display.component.spec.ts
│ │ │ └── log-display.component.ts
│ │ └── ticket-availability
│ │ ├── ticket-availability.component.css
│ │ ├── ticket-availability.component.html
│ │ ├── ticket-availability.component.spec.ts
│ │ └── ticket-availability.component.ts
│ ├── models
│ │ └── configuration.model.ts
│ │── services
│ │ │── count-display.service.ts
│ │ │── line-chart.service.ts
│ │ └── ticket-availability.service.ts
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ │── app.routes.ts
│ └── app.config.ts
├── assets
├── index.html
├── main.ts
└── styles.css
Java Development Kit (JDK) : version Java 17 or higher
Node.js : Version: >= 16.x.x
npm : Version: >= 8.x.x
Angular CLI : Version: ^18.2.8
TypeScript : Version: >= 4.x.x
Maven: Version: 3.9.9
- Clone the Real-Time-Event-Ticketing-System-W2051760 repository:
❯ git clone https://github.com/Chamod07/ticketing-system.git
- Navigate to the project directory:
❯ cd ticketing-system
- Navigate to the backend directory:
❯ cd backend
- Install dependencies and build the project:
❯ ./mvnw clean install
- Navigate to the frontend directory:
❯ cd frontend
- Install dependencies:
❯ npm install
To run the project, execute the following command:
- Navigate to the backend directory:
❯ cd backend
- Run the backend server:
❯ ./mvnw spring-boot:run
- Navigate to the frontend directory:
❯ cd frontend
- Run the frontend development server:
❯ ng serve
The Real-Time Ticketing System API provides endpoints to configure the system, manage vendors and customers, monitor system status, and manage ticket pool capacity. For additional details on using each endpoint, refer to the full API documentation on Postman.
-
Get Configuration
- Endpoint:
GET /api/v1/system-config
- Description: Retrieves current configuration settings.
- Response:
{ "totalTickets": 0, "ticketReleaseRate": 0, "customerRetrievalRate": 0, "maxTicketCapacity": 0 }
- Endpoint:
-
Set Configuration
- Endpoint:
POST /api/v1/system-config
- Description: Updates system configuration.
- Request Body:
{ "totalTickets": 50, "ticketReleaseRate": 5, "customerRetrievalRate": 4, "maxTicketCapacity": 100 }
- Endpoint:
-
Get System State
- Endpoint:
GET /api/v1/system/state
- Description: Retrieves the system's current state (e.g., Started, Stopped, Paused).
- Endpoint:
-
Start System
- Endpoint:
POST /api/v1/system/start
- Description: Starts the system.
- Response: "System started successfully."
- Endpoint:
-
Pause System
- Endpoint:
POST /api/v1/system/pause
- Description: Pauses the system.
- Response: "System paused successfully."
- Endpoint:
-
Pause System
- Endpoint:
POST /api/v1/system/pause
- Description: Pauses the system.
- Response: "System paused successfully."
- Endpoint:
-
Stop and Reset System
- Endpoint:
POST /api/v1/system/stop
- Description: Stops and resets the system.
- Response: "System stopped successfully."
- Endpoint:
-
Retrieve Customer Count
- Endpoint:
GET /api/v1/customer/count
- Description: Gets the count of active customers.
- Endpoint:
-
Retrieve VIP Customer Count
- Endpoint:
GET /api/v1/customer/count-vip
- Description: Gets the count of active VIP customers.
- Endpoint:
-
Add Customer
- Endpoint:
POST /api/v1/customer/add
- Description: Adds a new customer to the system.
- Endpoint:
-
Add VIP Customer
- Endpoint:
POST /api/v1/customer/add-vip
- Description: Adds a new VIP customer to the system.
- Endpoint:
-
Remove Customer
- Endpoint:
POST /api/v1/customer/remove
- Description: Removes a customer from the system.
- Endpoint:
-
Remove VIP Customer
- Endpoint:
POST /api/v1/customer/remove-vip
- Description: Removes a VIP customer from the system.
- Endpoint:
-
Retrieve Vendor Count
- Endpoint:
GET /api/v1/vendor/count
- Description: Retrieves the count of active vendors.
- Endpoint:
-
Add Vendor
- Endpoint:
POST /api/v1/vendor/add
- Description: Adds a new vendor to the system.
- Endpoint:
-
Remove Vendor
- Endpoint:
POST /api/v1/vendor/remove
- Description: Removes a vendor from the system.
- Endpoint:
-
Retrieve Available Tickets
- Endpoint:
GET /api/v1/tickets/availability
- Description: Retrieves the number of available tickets.
- Endpoint:
-
Retrieve Purchased Tickets
- Endpoint:
GET /api/v1/tickets/purchased
- Description: Retrieves the total number of tickets purchased.
- Endpoint:
-
Retrieve Released Tickets
- Endpoint:
GET /api/v1/tickets/released
- Description: Retrieves the total number of tickets released.
- Endpoint:
-
Retrieve Maximum Capacity of Tickets
- Endpoint:
GET /api/v1/tickets/max-capacity
- Description: Retrieves the maximum capacity of the system.
- Endpoint:
- Retrieve System Logs
- Endpoint:
GET /api/v1/log/latest
- Description: Retrieves the latest logs of the system.
- Response:
{ "id": 1110, "action": "[Vendor-1] Added 5 tickets. (Pool size-25)", "timestamp": "2024-12-12T02:00:47.9287035" }
- Endpoint:
This project is protected under the MIT License License.
I'd like to thank the instructors at the Institute of Information Technology (IIT) for their crucial assistance and support throughout this project. Special thanks to the Object-Oriented Programming (OOP) module team for their thoughts and training that laid the groundwork for this effort. Their commitment to promoting a thorough understanding of OOP principles and real-world applications has been extremely beneficial to my progress. Thank you for motivating and empowering me to face this issue.