
org.jobrunr.jobs.lambdas.JobLambda Maven / Gradle / Ivy
package org.jobrunr.jobs.lambdas;
/**
* This is a functional interface which represents a lambda that will be parsed by JobRunr.
* You may not create an actual instance of this class, instead you use it as follows:
*
* {@code
*
* @Inject
* MyService myService;
*
* BackgroundJob.enqueue(myService -> myService.doWork("some argument"))
* }
*
* or
*
{@code
*
* @Inject
* MyService myService;
*
* jobScheduler.enqueue(myService -> myService.doWork("some argument"))
* }
*
* This functional interface allows you to enqueue background jobs while having an actual instance available of your service.
* While processing, JobRunr will lookup the actual service in the IoC container or create a new instance using the default constructor.
*/
@FunctionalInterface
public interface JobLambda extends JobRunrJob {
void run() throws Exception;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy