Class JobRunr


  • public class JobRunr
    extends java.lang.Object
    This class provides the entry point for the JobRunr configuration. This is needed when you want to use the static methods on BackgroundJob to enqueue and schedule jobs. It also allows to startup the Dashboard which will be available on port 8000.
    An example:
          JobRunr.configure()
                     .useJobStorageProvider(jobStorageProvider)
                     .useJobActivator(jobActivator)
                     .useDefaultBackgroundJobServer()
                     .useJmxExtensions()
                     .useDashboard()
                     .initialize();
     
    Both the backgroundJobServer and the dashboard fluent API allow to be enabled or disabled using ENV variables which is handy in docker containers.
    An example:
         boolean isBackgroundJobServerEnabled = true; // or get it via ENV variables
         boolean isDashboardEnabled = true; // or get it via ENV variables
         JobRunr.configure()
                     .useJobStorageProvider(jobStorageProvider)
                     .useJobActivator(jobActivator)
                     .useDefaultBackgroundJobServerIf(isBackgroundJobServerEnabled)
                     .useDashboardIf(isDashboardEnabled)
                     .useJmxExtensions()
                     .initialize();