Class JobRunrConfiguration


  • public class JobRunrConfiguration
    extends java.lang.Object
    The main class to cofigure JobRunr
    • Method Detail

      • useStorageProvider

        public JobRunrConfiguration useStorageProvider​(StorageProvider storageProvider)
        Allows to set the StorageProvider that JobRunr will use.
        Parameters:
        storageProvider - the StorageProvider to use
        Returns:
        the same configuration instance which provides a fluent api
      • withJobFilter

        public JobRunrConfiguration withJobFilter​(JobFilter... jobFilters)
        Allows to set extra JobFilters or to provide another implementation of the RetryFilter
        Parameters:
        jobFilters - the jobFilters to use for each job.
        Returns:
        the same configuration instance which provides a fluent api
      • useDefaultBackgroundJobServer

        public JobRunrConfiguration useDefaultBackgroundJobServer()
        Provides a default BackgroundJobServer that is configured using a number of threads depending on the amount of CPU.
        Returns:
        the same configuration instance which provides a fluent api
      • useDefaultBackgroundJobServerIf

        public JobRunrConfiguration useDefaultBackgroundJobServerIf​(boolean guard)
        Provides a default BackgroundJobServer if the guard is true and that is configured using a number of threads depending on the amount of CPU.
        Parameters:
        guard - whether to start a BackgroundJobServer or not.
        Returns:
        the same configuration instance which provides a fluent api
      • useDefaultBackgroundJobServer

        public JobRunrConfiguration useDefaultBackgroundJobServer​(int workerCount)
        Provides a default BackgroundJobServer that is configured using a given number of threads.
        Parameters:
        workerCount - the number of worker threads to use
        Returns:
        the same configuration instance which provides a fluent api
      • useDefaultBackgroundJobServerIf

        public JobRunrConfiguration useDefaultBackgroundJobServerIf​(boolean guard,
                                                                    int workerCount)
        Provides a default BackgroundJobServer if the guard is true and that is configured using a given number of threads.
        Parameters:
        guard - whether to start a BackgroundJobServer or not.
        workerCount - the number of worker threads to use
        Returns:
        the same configuration instance which provides a fluent api
      • useBackgroundJobServer

        public JobRunrConfiguration useBackgroundJobServer​(BackgroundJobServer backgroundJobServer)
        Provides JobRunr with the given BackgroundJobServer
        Parameters:
        backgroundJobServer - the backgroundJobServer to use
        Returns:
        the same configuration instance which provides a fluent api
      • useBackgroundJobServerIf

        public JobRunrConfiguration useBackgroundJobServerIf​(boolean guard,
                                                             BackgroundJobServer backgroundJobServer)
        Provides JobRunr with the given BackgroundJobServer if the guard is true
        Parameters:
        guard - whether to start a BackgroundJobServer or not.
        backgroundJobServer - the backgroundJobServer to use
        Returns:
        the same configuration instance which provides a fluent api
      • useDashboard

        public JobRunrConfiguration useDashboard()
        Provides a dashboard on port 8000
        Returns:
        the same configuration instance which provides a fluent api
      • useDashboardIf

        public JobRunrConfiguration useDashboardIf​(boolean guard)
        Provides a dashboard on port 8000 if the guard is true
        Parameters:
        guard - whether to start a Dashboard or not.
        Returns:
        the same configuration instance which provides a fluent api
      • useDashboard

        public JobRunrConfiguration useDashboard​(int dashboardPort)
        Provides a dashboard on the given port
        Parameters:
        dashboardPort - the port on which to start the JobRunrDashboardWebServer
        Returns:
        the same configuration instance which provides a fluent api
      • useDashboardIf

        public JobRunrConfiguration useDashboardIf​(boolean guard,
                                                   int dashboardPort)
        Provides a dashboard on the given port if the guard is true
        Parameters:
        guard - whether to start a Dashboard or not.
        dashboardPort - the port on which to start the JobRunrDashboardWebServer
        Returns:
        the same configuration instance which provides a fluent api
      • useJmxExtensions

        public JobRunrConfiguration useJmxExtensions()
        If called, this method will register JMX Extensions to monitor JobRunr via JMX
        Returns:
        the same configuration instance which provides a fluent api
      • initialize

        public JobScheduler initialize()
        Initializes JobRunr and returns a JobScheduler which can then be used to register in the IoC framework or to enqueue/schedule some Jobs.
        Returns:
        a JobScheduler to enqueue/schedule new jobs