A sample project on how to utilize Apache camel to create a dynamic scheduler based on the given cron attributes.
- Clone the project
cd
into the project directory- Run the service by typing
./mvnw spring-boot:run
There are two endpoints available for you to create the scheduler.
- Default Scheduler
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' localhost:8080/api/schedulers/default/{your_message}
E.g.
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' localhost:8080/api/schedulers/default/Heavy+Process
- Custom Scheduler
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{"seconds": "[0-59]", "minutes": "[0-59]", "hours": "[0-23]", "dayOfMonth": "[1-31]", "months": "[1-12]", "dayOfWeek": "[1-7]", "message": "<your message>"}' localhost:8080/api/schedulers
E.g. To create a scheduler that will be running for every 7 seconds:
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{"seconds": "7", "message": "Heavy Processes"}' localhost:8080/api/schedulers