This repository shows an example how you can integrate JobRunr and Micronaut.
To integrate JobRunr into Micronaut:
- just add the dependency:
org.jobrunr:jobrunr-micronaut-feature:LATEST
- make sure that you configure JobRunr in the micronaut
application.yml
jobrunr:
job-scheduler:
enabled: true
background-job-server:
enabled: true
dashboard:
enabled: true
- JobRunr will automatically find the correct StorageProvider.
This project has the following packages:
- org.jobrunr.examples: this package contains the application class that bootstraps the Micronaut app.
- org.jobrunr.examples.services: this package contains MyService, a simple
@Singleton
service with some example methods which you can run in the background. - org.jobrunr.examples.webap.api: this package contains the following http resource:
JobController
: this resource contains a couple of REST api's which allows you to enqueue new Background Jobs
- clone the project and open it in your favorite IDE that supports Maven
- Set the environment variable
JOBRUNR_JOBS
totrue
if you want to run the jobs (by default it's false)- You can also just update
application.yml
to by pass the requirement for an env var
- You can also just update
- Run the Maven plugin
./gradlew run
and wait for Micronaut to be up & running- Or run Application
- Open your favorite browser:
- Navigate to the JobRunr dashboard located at http://localhost:8000/dashboard.
- Navigate to the JobController at http://localhost:8080/jobs/ to enqueue jobs
- Visit the dashboard again and see the jobs being processed!
Note: Running micronaut apps with JobRunr using GraalVM native mode is not yet supported.