This project is a Quartz-based scheduling system integrated with Spring Boot. It schedules tasks based on deadlines and triggers notifications accordingly.
- Uses Quartz Scheduler to manage job execution.
- Loads tasks from the database on application startup and schedules them.
- Supports dynamic task scheduling based on deadlines.
- Java (Spring Boot)
- Quartz Scheduler
- Spring Data JPA
- Lombok
- H2/PostgreSQL (Choose based on configuration)
java
├── com.bexos.quartz_scheduler
├── QuartzSchedulerApplication.java
├── config
│ └── QuartzConfig.java
├── dto
│ ├── MessageResponse.java
│ └── TaskRequest.java
├── exception
│ ├── BadRequestException.java
│ ├── GlobalExceptionHandler.java
│ └── NotFoundException.java
├── job
│ └── NotificationJob.java
├── model
│ └── Task.java
├── repository
│ └── TaskRepository.java
├── service
│ ├── NotificationService.java
│ ├── TaskSchedulerService.java
│ ├── TaskService.java
│ └── impl
│ ├── NotificationServiceImpl.java
│ ├── TaskSchedulerServiceImpl.java
│ └── TaskServiceImpl.java
└── util
└── ApplicationStartup.java
└── resources
├── application-dev.yml
├── application-prod.yml
├── application.properties
Located in QuartzConfig.java, this configures the Quartz Scheduler factory and initializes the scheduler.
ApplicationStartup.javaloads pending tasks on startup and schedules them.TaskSchedulerServiceImpl.javaschedules individual tasks with Quartz.
- Clone the repository:
git clone https://github.com/your-repo/quartz-scheduler.git
- Navigate to the project directory:
cd quartz-scheduler - Build and run the application:
mvn spring-boot:run
- On Application Startup:
- Fetches all stored tasks from the database.
- Schedules tasks with deadlines that haven't been notified yet.
- Task Scheduling:
- A
Taskentity contains adeadlinefield. - The
TaskSchedulerServiceImplschedules jobs usingQuartz Scheduler.
- A
- Notification Execution:
- Quartz triggers the
NotificationJobat the scheduled time.
- Quartz triggers the
- Modify
TaskSchedulerServiceImpl.javato add more job logic. - Change
ApplicationStartup.javato load tasks differently. - Configure spring profiles in
application.ymlin order to use persistence database.