Quartz Shedlock Migration is a Java/Spring Boot project that utilizes Quartz Scheduler and Shedlock to provide distributed lock functionality for scheduled tasks. This project is built using Maven and requires JDK 21 or later.
- Integration of Quartz Scheduler for job scheduling.
- Use of Shedlock for distributed lock management.
- Maven for project build and dependency management.
- Developed and tested with JDK 21.
Make sure you have the following installed on your machine:
- Java Development Kit (JDK) 21 or later
- Maven
- GraalVM Native Image
- Docker
1. Clone the repository:
git clone https://github.com/korkutkose/quartz-shedlock-migration.git
cd quartz-shedlock-migration
2. Install and Run The Application:
mvn clean install
mvn spring-boot:run
3. Enable Different Profile
- By default, the application runs with the
shedlock
profile. - To enable the
quartz
profile, you can use the following command:mvn spring-boot:run -Dspring-boot.run.profiles=quartz
4. Build Native Image Locally
Do not forget to install and set the
GRAALVM_HOME
environment variable to the GraalVM installation directory.
- To build a native image of the application, you can use the following command:
mvn clean package -Pnative native:compile
- To run the native image, you can use the following command:
./target/native-executable-app
- To run the native image with profile, you can use the following command:
./target/native-executable-app --spring.profiles.active=quartz
Do not forget to install Docker on your machine and make sure that the Docker daemon is running.
- Run docker-compose to build and run the application:
This will take some time to build since this will be a multi-stage GraalVM native build.
docker-compose -f docker-compose.yml -p quartz-shedlock-migration up -d
- You can also provide additional profile while running the docker-compose command:
APP_ACTIVE_PROFILE=quartz docker-compose -f docker-compose.yml -p quartz-shedlock-migration up -d
- Check the logs to see if the application is running:
docker-compose -f docker-compose.yml -p quartz-shedlock-migration logs -f
- To stop the application, you can use the following command:
docker-compose -f docker-compose.yml -p quartz-shedlock-migration down
If you want to contact me you can reach me at;