Interface JobManager
- All Known Implementing Classes:
DefaultJobManager
public interface JobManager
Contains methods that are not tied to any specific job type (async, timer, suspended or deadletter), but which are generally applicable or are about going from one type to another.
- Author:
- Tijs Rademakers, Joram Barrez
-
Method Summary
Modifier and TypeMethodDescriptionTransforms aSuspendedJobEntity
back to anAbstractRuntimeJobEntity
(i.e.void
bulkMoveTimerJobsToExecutableJobs
(List<TimerJobEntity> timerJobEntities) Moves a collection ofTimerJobEntity
instances to become asyncJobEntity
instances (the timer is deleted and a new async job is inserted).copyJobInfo
(AbstractRuntimeJobEntity copyToJob, AbstractRuntimeJobEntity copyFromJob) Copy job info from one job to the othervoid
createAsyncJob
(JobEntity jobEntity, boolean exclusive) Creates an async job so that it can be continued later in a background thread.createDeadLetterJobFromHistoryJob
(HistoryJobEntity historyJobEntity) Create a dead letter job from a history job.Create a dead letter job from another jobCreate an executable job from another jobCreate an external worker job from another jobCreate a suspended job from another jobCreate a timer job from another jobvoid
void
Execute a job, which means that the logic (async logic, timer that fires, etc) is executed, typically by a background thread of an executor.getBusinessCalendarName
(JobEntity timerEntity, VariableScope variableScope) Get the business calendar name of the job configurationmoveDeadLetterJobToExecutableJob
(DeadLetterJobEntity deadLetterJobEntity, int retries) Transforms aDeadLetterJobEntity
to aJob
, thus making it executable again.moveDeadLetterJobToHistoryJob
(DeadLetterJobEntity deadLetterJobEntity, int retries) Transforms aDeadLetterJobEntity
to aHistoryJob
, thus making it executable again (by the async history executor).moveExternalWorkerJobToExecutableJob
(ExternalWorkerJobEntity externalWorkerJob) Moves anExternalWorkerJobEntity
to become an asyncJobEntity
.Transforms anAbstractRuntimeJobEntity
to aDeadLetterJobEntity
.Moves anAbstractRuntimeJobEntity
to become aSuspendedJobEntity
, such that theAsyncExecutor
won't pick it up anymore for execution.Moves anAbstractRuntimeJobEntity
to become aTimerJobEntity
.moveTimerJobToExecutableJob
(TimerJobEntity timerJob) Moves aTimerJobEntity
to become an asyncJobEntity
.void
Schedules and async job.scheduleHistoryJob
(HistoryJobEntity historyJobEntity, TransactionContext transactionContext) schedules aHistoryJobEntity
, meaning it will be scheduled (inserted in the database/put on a queue/...) to be executed at a later point in time.void
scheduleTimerJob
(TimerJobEntity timerJob) Schedules a timer, meaning it will be inserted in the datastore.void
setJobServiceConfiguration
(JobServiceConfiguration jobServiceConfiguration) The ProcessEngineConfiguration instance will be passed when the ProcessEngine is built.void
Unacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes.void
unacquireWithDecrementRetries
(JobInfo job, Throwable exception) Unacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes.
-
Method Details
-
execute
Execute a job, which means that the logic (async logic, timer that fires, etc) is executed, typically by a background thread of an executor. -
unacquire
Unacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes. -
unacquireWithDecrementRetries
Unacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes. -
createAsyncJob
Creates an async job so that it can be continued later in a background thread. -
scheduleAsyncJob
Schedules and async job. If theAsyncExecutor
is running, it can be executed immediately after the transaction. Otherwise it can be picked up by other executors. -
scheduleTimerJob
Schedules a timer, meaning it will be inserted in the datastore. -
getBusinessCalendarName
Get the business calendar name of the job configuration -
moveTimerJobToExecutableJob
Moves aTimerJobEntity
to become an asyncJobEntity
. This happens for example when the due date of a timer is reached, the timer entity then becomes a 'regular' async job that can be picked up by theAsyncExecutor
. -
bulkMoveTimerJobsToExecutableJobs
Moves a collection ofTimerJobEntity
instances to become asyncJobEntity
instances (the timer is deleted and a new async job is inserted). Note that there are no revision checks happening on theTimerJobEntity
instances, this means this method should only be used when running with a global acquire lock. -
moveExternalWorkerJobToExecutableJob
Moves anExternalWorkerJobEntity
to become an asyncJobEntity
. This happens when the external worker has completed the work and the external work job then becomes a 'regular' async job that can be picked up by theAsyncExecutor
. -
moveJobToTimerJob
Moves anAbstractRuntimeJobEntity
to become aTimerJobEntity
. This happens for example when an async job is executed and fails. It then becomes a timer, as it needs to be retried later. -
moveJobToSuspendedJob
Moves anAbstractRuntimeJobEntity
to become aSuspendedJobEntity
, such that theAsyncExecutor
won't pick it up anymore for execution. -
activateSuspendedJob
Transforms aSuspendedJobEntity
back to anAbstractRuntimeJobEntity
(i.e. to what it was originally). The job will now again be able to picked up by theAsyncExecutor
. -
moveJobToDeadLetterJob
Transforms anAbstractRuntimeJobEntity
to aDeadLetterJobEntity
. This means that the job has been tried a configurable amount of times, but kept failing. -
moveDeadLetterJobToExecutableJob
Transforms aDeadLetterJobEntity
to aJob
, thus making it executable again. Note that a 'retries' parameter needs to be passed, as the job got into the deadletter table because of it failed and retries became 0. -
moveDeadLetterJobToHistoryJob
HistoryJobEntity moveDeadLetterJobToHistoryJob(DeadLetterJobEntity deadLetterJobEntity, int retries) Transforms aDeadLetterJobEntity
to aHistoryJob
, thus making it executable again (by the async history executor). Note that a 'retries' parameter needs to be passed, as the job got into the deadletter table because of it failed and retries became 0. -
deleteExecutableJob
-
scheduleHistoryJob
HistoryJobEntity scheduleHistoryJob(HistoryJobEntity historyJobEntity, TransactionContext transactionContext) schedules aHistoryJobEntity
, meaning it will be scheduled (inserted in the database/put on a queue/...) to be executed at a later point in time. -
setJobServiceConfiguration
The ProcessEngineConfiguration instance will be passed when the ProcessEngine is built. -
createExecutableJobFromOtherJob
Create an executable job from another job -
createTimerJobFromOtherJob
Create a timer job from another job -
createSuspendedJobFromOtherJob
Create a suspended job from another job -
createDeadLetterJobFromOtherJob
Create a dead letter job from another job -
createDeadLetterJobFromHistoryJob
Create a dead letter job from a history job. This is different fromcreateDeadLetterJobFromOtherJob(AbstractRuntimeJobEntity)
, because history jobs have different data and cannot become timer/suspended/executable jobs. -
createExternalWorkerJobFromOtherJob
Create an external worker job from another job -
copyJobInfo
AbstractRuntimeJobEntity copyJobInfo(AbstractRuntimeJobEntity copyToJob, AbstractRuntimeJobEntity copyFromJob) Copy job info from one job to the other
-