Package org.jobrunr.configuration
Class JobRunrConfiguration
- java.lang.Object
-
- org.jobrunr.configuration.JobRunrConfiguration
-
public class JobRunrConfiguration extends java.lang.Object
The main class to configure JobRunr
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JobScheduler
initialize()
Initializes JobRunr and returns aJobScheduler
which can then be used to register in the IoC framework or to enqueue/schedule some Jobs.JobRunrConfiguration
useBackgroundJobServer()
Provides a defaultBackgroundJobServer
that is configured using a number of threads depending on the amount of CPU.JobRunrConfiguration
useBackgroundJobServer(int workerCount)
Provides a defaultBackgroundJobServer
that is configured using a given number of threads.JobRunrConfiguration
useBackgroundJobServer(BackgroundJobServerConfiguration configuration)
Provides a defaultBackgroundJobServer
that is configured using the givenBackgroundJobServerConfiguration
JobRunrConfiguration
useBackgroundJobServer(BackgroundJobServerConfiguration configuration, boolean startBackgroundJobServer)
Provides a defaultBackgroundJobServer
that is configured using the givenBackgroundJobServerConfiguration
JobRunrConfiguration
useBackgroundJobServerIf(boolean guard)
Provides a defaultBackgroundJobServer
if the guard is true and that is configured using a number of threads depending on the amount of CPU.JobRunrConfiguration
useBackgroundJobServerIf(boolean guard, int workerCount)
Provides a defaultBackgroundJobServer
if the guard is true and that is configured using a given number of threads.JobRunrConfiguration
useBackgroundJobServerIf(boolean guard, BackgroundJobServerConfiguration configuration)
Provides a defaultBackgroundJobServer
if the guard is true and that is configured using the givenBackgroundJobServerConfiguration
JobRunrConfiguration
useBackgroundJobServerIf(boolean guard, BackgroundJobServerConfiguration configuration, boolean startBackgroundJobServer)
Provides a defaultBackgroundJobServer
if the guard is true and that is configured using the givenBackgroundJobServerConfiguration
JobRunrConfiguration
useDashboard()
Provides a dashboard on port 8000JobRunrConfiguration
useDashboard(int dashboardPort)
Provides a dashboard on the given portJobRunrConfiguration
useDashboard(JobRunrDashboardWebServerConfiguration configuration)
Provides a dashboard using the givenJobRunrDashboardWebServerConfiguration
JobRunrConfiguration
useDashboardIf(boolean guard)
Provides a dashboard on port 8000 if the guard is trueJobRunrConfiguration
useDashboardIf(boolean guard, int dashboardPort)
Provides a dashboard on the given port if the guard is trueJobRunrConfiguration
useDashboardIf(boolean guard, JobRunrDashboardWebServerConfiguration configuration)
Provides a dashboard using the givenJobRunrDashboardWebServerConfiguration
if the guard is trueJobRunrConfiguration
useJmxExtensions()
If called, this method will register JMX Extensions to monitor JobRunr via JMXJobRunrConfiguration
useJmxExtensionsIf(boolean guard)
Enables JMX Extensions to monitor JobRunr via JMX if the guard is trueJobRunrConfiguration
useJobActivator(JobActivator jobActivator)
TheJobActivator
is used to resolve jobs from the IoC frameworkJobRunrConfiguration
useStorageProvider(StorageProvider storageProvider)
Allows to set the StorageProvider that JobRunr will use.JobRunrConfiguration
withJobFilter(JobFilter... jobFilters)
Allows to set extra JobFilters or to provide another implementation of theRetryFilter
-
-
-
Method Detail
-
useJobActivator
public JobRunrConfiguration useJobActivator(JobActivator jobActivator)
TheJobActivator
is used to resolve jobs from the IoC framework- Parameters:
jobActivator
- theJobActivator
to use- Returns:
- the same configuration instance which provides a fluent api
-
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 theRetryFilter
- Parameters:
jobFilters
- the jobFilters to use for each job.- Returns:
- the same configuration instance which provides a fluent api
-
useBackgroundJobServer
public JobRunrConfiguration useBackgroundJobServer()
Provides a defaultBackgroundJobServer
that is configured using a number of threads depending on the amount of CPU.- Returns:
- the same configuration instance which provides a fluent api
-
useBackgroundJobServerIf
public JobRunrConfiguration useBackgroundJobServerIf(boolean guard)
Provides a defaultBackgroundJobServer
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
-
useBackgroundJobServer
public JobRunrConfiguration useBackgroundJobServer(int workerCount)
Provides a defaultBackgroundJobServer
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
-
useBackgroundJobServerIf
public JobRunrConfiguration useBackgroundJobServerIf(boolean guard, int workerCount)
Provides a defaultBackgroundJobServer
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(BackgroundJobServerConfiguration configuration)
Provides a defaultBackgroundJobServer
that is configured using the givenBackgroundJobServerConfiguration
- Parameters:
configuration
- the configuration for the backgroundJobServer to use- Returns:
- the same configuration instance which provides a fluent api
-
useBackgroundJobServer
public JobRunrConfiguration useBackgroundJobServer(BackgroundJobServerConfiguration configuration, boolean startBackgroundJobServer)
Provides a defaultBackgroundJobServer
that is configured using the givenBackgroundJobServerConfiguration
- Parameters:
configuration
- the configuration for the backgroundJobServer to usestartBackgroundJobServer
- whether to start the background job server immediately- Returns:
- the same configuration instance which provides a fluent api
-
useBackgroundJobServerIf
public JobRunrConfiguration useBackgroundJobServerIf(boolean guard, BackgroundJobServerConfiguration configuration)
Provides a defaultBackgroundJobServer
if the guard is true and that is configured using the givenBackgroundJobServerConfiguration
- Parameters:
guard
- whether to start a BackgroundJobServer or not.configuration
- the configuration for the backgroundJobServer to use- Returns:
- the same configuration instance which provides a fluent api
-
useBackgroundJobServerIf
public JobRunrConfiguration useBackgroundJobServerIf(boolean guard, BackgroundJobServerConfiguration configuration, boolean startBackgroundJobServer)
Provides a defaultBackgroundJobServer
if the guard is true and that is configured using the givenBackgroundJobServerConfiguration
- Parameters:
guard
- whether to create a BackgroundJobServer or not.configuration
- the configuration for the backgroundJobServer to usestartBackgroundJobServer
- whether to start the background job server immediately- 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 theJobRunrDashboardWebServer
- 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 theJobRunrDashboardWebServer
- Returns:
- the same configuration instance which provides a fluent api
-
useDashboard
public JobRunrConfiguration useDashboard(JobRunrDashboardWebServerConfiguration configuration)
Provides a dashboard using the givenJobRunrDashboardWebServerConfiguration
- Parameters:
configuration
- theJobRunrDashboardWebServerConfiguration
to use- Returns:
- the same configuration instance which provides a fluent api
-
useDashboardIf
public JobRunrConfiguration useDashboardIf(boolean guard, JobRunrDashboardWebServerConfiguration configuration)
Provides a dashboard using the givenJobRunrDashboardWebServerConfiguration
if the guard is true- Parameters:
guard
- whether to start a Dashboard or not.configuration
- theJobRunrDashboardWebServerConfiguration
to use- 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
-
useJmxExtensionsIf
public JobRunrConfiguration useJmxExtensionsIf(boolean guard)
Enables JMX Extensions to monitor JobRunr via JMX if the guard is true- Parameters:
guard
- whether to start the JXM Extensions or not.- Returns:
- the same configuration instance which provides a fluent api
-
initialize
public JobScheduler initialize()
Initializes JobRunr and returns aJobScheduler
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
-
-