Package org.jobrunr.configuration
Class JobRunrConfiguration
java.lang.Object
org.jobrunr.configuration.JobRunrConfiguration
The main class to configure JobRunr
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionInitializes JobRunr and returns aJobScheduler
which can then be used to register in the IoC framework or to enqueue/schedule some Jobs.Provides a defaultBackgroundJobServer
that is configured using a number of threads depending on the amount of CPU.useBackgroundJobServer
(int workerCount) Provides a defaultBackgroundJobServer
that is configured using a given number of threads.useBackgroundJobServer
(BackgroundJobServerConfiguration configuration) Provides a defaultBackgroundJobServer
that is configured using the givenBackgroundJobServerConfiguration
useBackgroundJobServer
(BackgroundJobServerConfiguration configuration, boolean startBackgroundJobServer) Provides a defaultBackgroundJobServer
that is configured using the givenBackgroundJobServerConfiguration
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.useBackgroundJobServerIf
(boolean guard, int workerCount) Provides a defaultBackgroundJobServer
if the guard is true and that is configured using a given number of threads.useBackgroundJobServerIf
(boolean guard, BackgroundJobServerConfiguration configuration) Provides a defaultBackgroundJobServer
if the guard is true and that is configured using the givenBackgroundJobServerConfiguration
useBackgroundJobServerIf
(boolean guard, BackgroundJobServerConfiguration configuration, boolean startBackgroundJobServer) Provides a defaultBackgroundJobServer
if the guard is true and that is configured using the givenBackgroundJobServerConfiguration
Provides a dashboard on port 8000useDashboard
(int dashboardPort) Provides a dashboard on the given portuseDashboard
(JobRunrDashboardWebServerConfiguration configuration) Provides a dashboard using the givenJobRunrDashboardWebServerConfiguration
useDashboardIf
(boolean guard) Provides a dashboard on port 8000 if the guard is trueuseDashboardIf
(boolean guard, int dashboardPort) Provides a dashboard on the given port if the guard is trueuseDashboardIf
(boolean guard, JobRunrDashboardWebServerConfiguration configuration) Provides a dashboard using the givenJobRunrDashboardWebServerConfiguration
if the guard is trueIf called, this method will register JMX Extensions to monitor JobRunr via JMXuseJmxExtensionsIf
(boolean guard) Enables JMX Extensions to monitor JobRunr via JMX if the guard is trueuseJobActivator
(JobActivator jobActivator) TheJobActivator
is used to resolve jobs from the IoC frameworkuseJobDetailsGenerator
(JobDetailsGenerator jobDetailsGenerator) Specifies whichJobDetailsGenerator
to use.useJsonMapper
(JsonMapper jsonMapper) TheJsonMapper
to transform jobs to json in the databaseuseMicroMeter
(JobRunrMicroMeterIntegration microMeterIntegration) Allows integrating MicroMeter metrics into JobRunruseStorageProvider
(StorageProvider storageProvider) Allows to set the StorageProvider that JobRunr will use.withJobFilter
(JobFilter... jobFilters) Allows setting extra JobFilters or to provide another implementation of theRetryFilter
-
Method Details
-
useJsonMapper
TheJsonMapper
to transform jobs to json in the database- Parameters:
jsonMapper
- theJsonMapper
to use- Returns:
- the same configuration instance which provides a fluent api
-
useJobActivator
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
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
Allows setting 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
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
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
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
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
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
Provides a dashboard on port 8000- Returns:
- the same configuration instance which provides a fluent api
-
useDashboardIf
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
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
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
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
If called, this method will register JMX Extensions to monitor JobRunr via JMX- Returns:
- the same configuration instance which provides a fluent api
-
useJmxExtensionsIf
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
-
useMicroMeter
Allows integrating MicroMeter metrics into JobRunr- Parameters:
microMeterIntegration
- the JobRunrMicroMeterIntegration- Returns:
- the same configuration instance which provides a fluent api
-
useJobDetailsGenerator
Specifies whichJobDetailsGenerator
to use.- Parameters:
jobDetailsGenerator
- the JobDetailsGenerator to use.- Returns:
- the same configuration instance which provides a fluent api
-
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
-