Package org.jobrunr.server
Class BackgroundJobServerConfiguration
java.lang.Object
org.jobrunr.server.BackgroundJobServerConfiguration
This class allows to configure the BackgroundJobServer
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionandBackgroundJobServerWorkerPolicy
(BackgroundJobServerWorkerPolicy backgroundJobServerWorkerPolicy) Allows to set the backgroundJobServerWorkerPolicy for the BackgroundJobServer.andConcurrentJobModificationPolicy
(ConcurrentJobModificationPolicy concurrentJobModificationPolicy) Allows to set the ConcurrentJobModificationPolicy for the BackgroundJobServer.andDeleteSucceededJobsAfter
(Duration duration) Allows to set the duration to wait before deleting succeeded jobsAllows to set the name for theBackgroundJobServer
andOrphanedJobsRequestSize
(int orphanedJobsRequestSize) Allows to set the query size for misfired jobs per polling interval (to retry them).andPermanentlyDeleteDeletedJobsAfter
(Duration duration) Allows to set the duration to wait before permanently deleting succeeded jobsandPollIntervalInSeconds
(int pollIntervalInSeconds) Allows to set the pollIntervalInSeconds for the BackgroundJobServerandScheduledJobsRequestSize
(int scheduledJobsRequestSize) Allows to set the maximum number of jobs to update from scheduled to enqueued state per polling interval.andSucceededJobsRequestSize
(int succeededJobsRequestSize) Allows to set the maximum number of jobs to update from succeeded to deleted state per polling interval.andWorkerCount
(int workerCount) Allows to set the workerCount for the BackgroundJobServer which defines the maximum number of jobs that will be run in parallelgetName()
int
int
int
int
This returns the default configuration with the BackgroundJobServer with a poll interval of 15 seconds and a worker count based on the CPU
-
Field Details
-
DEFAULT_POLL_INTERVAL_IN_SECONDS
public static final int DEFAULT_POLL_INTERVAL_IN_SECONDS- See Also:
-
DEFAULT_PAGE_REQUEST_SIZE
public static final int DEFAULT_PAGE_REQUEST_SIZE- See Also:
-
DEFAULT_DELETE_SUCCEEDED_JOBS_DURATION
-
DEFAULT_PERMANENTLY_DELETE_JOBS_DURATION
-
-
Method Details
-
usingStandardBackgroundJobServerConfiguration
This returns the default configuration with the BackgroundJobServer with a poll interval of 15 seconds and a worker count based on the CPU- Returns:
- the default JobRunrDashboard configuration
-
andName
Allows to set the name for theBackgroundJobServer
- Parameters:
name
- the name of this BackgroundJobServer (used in the dashboard)- Returns:
- the same configuration instance which provides a fluent api
-
andPollIntervalInSeconds
Allows to set the pollIntervalInSeconds for the BackgroundJobServer- Parameters:
pollIntervalInSeconds
- the pollIntervalInSeconds- Returns:
- the same configuration instance which provides a fluent api
-
andWorkerCount
Allows to set the workerCount for the BackgroundJobServer which defines the maximum number of jobs that will be run in parallel- Parameters:
workerCount
- the workerCount for the BackgroundJobServer- Returns:
- the same configuration instance which provides a fluent api
-
andBackgroundJobServerWorkerPolicy
public BackgroundJobServerConfiguration andBackgroundJobServerWorkerPolicy(BackgroundJobServerWorkerPolicy backgroundJobServerWorkerPolicy) Allows to set the backgroundJobServerWorkerPolicy for the BackgroundJobServer. The backgroundJobServerWorkerPolicy will determine the final WorkDistributionStrategy used by the BackgroundJobServer.- Parameters:
backgroundJobServerWorkerPolicy
- the backgroundJobServerWorkerPolicy- Returns:
- the same configuration instance which provides a fluent api
-
andScheduledJobsRequestSize
Allows to set the maximum number of jobs to update from scheduled to enqueued state per polling interval.- Parameters:
scheduledJobsRequestSize
- maximum number of jobs to update per polling interval- Returns:
- the same configuration instance which provides a fluent api
-
andOrphanedJobsRequestSize
Allows to set the query size for misfired jobs per polling interval (to retry them).- Parameters:
orphanedJobsRequestSize
- maximum number of misfired jobs to check per polling interval- Returns:
- the same configuration instance which provides a fluent api
-
andSucceededJobsRequestSize
Allows to set the maximum number of jobs to update from succeeded to deleted state per polling interval.- Parameters:
succeededJobsRequestSize
- maximum number of jobs to update per polling interval- Returns:
- the same configuration instance which provides a fluent api
-
andDeleteSucceededJobsAfter
Allows to set the duration to wait before deleting succeeded jobs- Parameters:
duration
- the duration to wait before deleting successful jobs- Returns:
- the same configuration instance which provides a fluent api
-
andPermanentlyDeleteDeletedJobsAfter
Allows to set the duration to wait before permanently deleting succeeded jobs- Parameters:
duration
- the duration to wait before permanently deleting successful jobs- Returns:
- the same configuration instance which provides a fluent api
-
andConcurrentJobModificationPolicy
public BackgroundJobServerConfiguration andConcurrentJobModificationPolicy(ConcurrentJobModificationPolicy concurrentJobModificationPolicy) Allows to set the ConcurrentJobModificationPolicy for the BackgroundJobServer. The ConcurrentJobModificationPolicy will determine how the BackgroundJobServer will react to concurrent modifications the jobs.Use with care.
- Parameters:
concurrentJobModificationPolicy
- the concurrentJobModificationPolicy- Returns:
- the same configuration instance which provides a fluent api
-
getName
-
getScheduledJobsRequestSize
public int getScheduledJobsRequestSize() -
getOrphanedJobsRequestSize
public int getOrphanedJobsRequestSize() -
getSucceededJobsRequestSize
public int getSucceededJobsRequestSize() -
getPollIntervalInSeconds
public int getPollIntervalInSeconds() -
getDeleteSucceededJobsAfter
-
getPermanentlyDeleteDeletedJobsAfter
-
getBackgroundJobServerWorkerPolicy
-
getConcurrentJobModificationPolicy
-