Package org.jobrunr.jobs.annotations
Annotation Type Job
-
@Target(METHOD) @Retention(RUNTIME) public @interface Job
Allows to add a specific name to a job that will be used in the dashboard as well as extra jobFilters that will be used for the job. The annotation can be used on the method that is referenced in the lambda.An example:
public class MyService { @Job(name = "Doing some work", jobFilters = {TheSunIsAlwaysShiningElectStateFilter.class, TestFilter.class}) public void doWork() { // some long running task } } MyService service = new MyService(); BackgroundJob.enqueue(() -> service.doWork());
In the Job name you can also reference parameters which where passed to the method.
An example:
public class MyService { @Job(name = "Doing some work for user %s", jobFilters = {TheSunIsAlwaysShiningElectStateFilter.class, TestFilter.class}) public void doWork(String userName) { // some long running task } } MyService service = new MyService(); BackgroundJob.enqueue(() -> service.doWork("Ronald"));
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.Class<? extends JobFilter>[]
jobFilters
java.lang.String
name
-
-
-
-
jobFilters
java.lang.Class<? extends JobFilter>[] jobFilters
- Default:
- {}
-
-