This repository shows a simple example on how you can integrate JobRunr with spring.io. In this example, Jobs are created via a web frontend.
A more advanced example using spring.io can be found here
This project has 2 packages:
- org.jobrunr.examples.services: this project contains SampleJobService, a simple spring service with examples methods which you want to run in a backgroundserver.
- Note that the method annotated with
@Recurring
will be automatically picked up by JobRunr and run every 2 minutes (specified by thecron
parameter)
- Note that the method annotated with
- org.jobrunr.examples.api: It contains a simple
RestController
called JobController which contains some methods (= endpoints) to enqueue, schedule, or delete jobs.
- clone the project and open it in your favorite IDE that supports gradle
- First, run the main method from the JobServerApplication
- Open your favorite browser:
- Navigate to the JobRunr dashboard located at http://localhost:8000/dashboard.
- To enqueue a simple job, open a new tab and go to http://localhost:8080/enqueue-example-job to create the job.
- See the JobController for other endpoints!
- Visit the dashboard again and see the jobs being processed!