Skip to main content

KADAI-jobs

Jobs are automated processes that run in the background of the application, usually periodically. They are scheduled for configurable times and then run by the scheduler. For example, the TaskCleanupJob deletes Tasks after they reached a certain time passed after their completion. You can read more about jobs here. Common options for jobs customization are listed and explained as following:

  • Batch size: Maximum number of entities that are processed in one job
  • Max number of retries: Maximum number of retries if a job fails
  • First run at: The date for the first run of the job
  • Run every: The interval between individual runs of a job

Additionally, different jobs have other special parameters for customization which can be found below. There is an example job configuration and execution at the end of this article.

You can also configure the scheduler. The scheduler will initialize the first schedule for the jobs. Each run, the scheduler looks up which jobs are past their due date. These jobs get executed. The behavior of jobs and the scheduler in KADAI can be customized in the configuration file kadai.properties with the following parameters:

Scheduler Configuration

ParameterDescriptionDefault Value
kadai.jobs.scheduler.enabledEnabling automated scheduling of jobstrue
kadai.jobs.scheduler.initialStartDelayStart delay before the first job gets scheduled100
kadai.jobs.scheduler.periodThe time interval between the individual runs of the scheduler5
kadai.jobs.scheduler.periodTimeUnitThe unit for scheduler.initialStartDelay and scheduler.periodMINUTES

General Jobs Configuration

These configuration options are overwritten by job-specific configuration options

ParameterDescriptionDefault Value
kadai.jobs.maxRetriesnumber of automatic retries after a job has failed3
kadai.jobs.batchSizeupper bound of how many tasks can be processed by one job100
kadai.jobs.runEveryperiod of time between the executions of jobs (Duration in ISO 8601 format)P1D
kadai.jobs.firstRunAtfirst time the job is run (DateTime n ISO 8601 format)2023-01-01T00:00:00Z
kadai.jobs.lockExpirationPeriodperiod of time the lock is valid (Duration in ISO 8601 format). Should be longer than the longest possible job execution timeP2D

TaskCleanupJob Configuration

ParameterDescriptionDefault Value
kadai.jobs.cleanup.task.enableEnabling automated cleanup of completed tasks after a period of time specified by job.runEverytrue
kadai.jobs.cleanup.task.minimumAgethe completed task can be deleted by the cleanup only after this period of time or later (Duration in ISO 8601 format)P14D
kadai.jobs.cleanup.task.allCompletedSameParentBusinessPrevent deletion of tasks if other tasks with same parent business process ID are not yet completedtrue
kadai.jobs.cleanup.task.lockExpirationPeriodperiod of time the lock is valid (Duration in ISO 8601 format). Should be longer than the longest possible job execution timePT30M

WorkbasketCleanupJob Configuration

ParameterDescriptionDefault Value
kadai.jobs.cleanup.workbasket.enableEnable WorkbasketCleanupJob to cleanup completed workbaskets after a period of time if no pending taskstrue
kadai.jobs.cleanup.workbasket.lockExpirationPeriodperiod of time the lock is valid (Duration in ISO 8601 format). Should be longer than the longest possible job execution timePT30M

HistoryCleanupJob Configuration

ParameterDescriptionDefault Value
kadai.jobs.cleanup.history.simple.enableEnables the HistoryCleanupJob to delete history eventsfalse
kadai.jobs.cleanup.history.simple.minimumAgea history event may only be deleted by the cleanup after this period of time or later (Duration in ISO 8601 format)P14D
kadai.jobs.cleanup.history.simple.batchSizeupper bound of how many history events can be processed by one history cleanup job100
kadai.jobs.cleanup.history.simple.allCompletedSameParentBusinessPrevent deletion of Task History Events if other Task History Events with same parent business process ID have types other than "CREATED"true
kadai.jobs.cleanup.history.simple.lockExpirationPeriodperiod of time the lock is valid (Duration in ISO 8601 format). Should be longer than the longest possible job execution timePT30M

TaskUpdatePriorityJob Configuration

ParameterDescriptionDefault Value
kadai.jobs.priority.task.enableEnabling automated recalculation of priority of each tasks that is not in an endstatefalse
kadai.jobs.priority.task.batchSizeupper bound of how many tasks can be processed by one TaskUpdatePriorityJob100
kadai.jobs.priority.task.runEveryperiod of time between the executions of the TaskUpdatePriorityJob (Duration in ISO 8601 format)P1D
kadai.jobs.priority.task.firstRunAtfirst time the job is executed (DateTime in ISO 8601 format)2023-01-01T00:00:00Z
kadai.jobs.priority.task.lockExpirationPeriodperiod of time the lock is valid (Duration in ISO 8601 format). Should be longer than the longest possible job execution timePT30M

UserInfoRefreshJob Configuration

ParameterDescriptionDefault Value
kadai.jobs.refresh.user.enableEnable job to refresh all user info after a period of timefalse
kadai.jobs.refresh.user.runEveryperiod of time between the executions of the UserInfoRefreshJob (Duration in ISO 8601 format)P1D
kadai.jobs.refresh.user.firstRunAtfirst time the job is executed (DateTime in ISO 8601 format)2023-01-01T23:00:00Z
kadai.jobs.refresh.user.lockExpirationPeriodperiod of time the lock is valid (Duration in ISO 8601 format). Should be longer than the longest possible job execution timePT30M

CustomJobs Configuration

ParameterDescriptionDefault Value
kadai.jobs.customJobsInitialize custom jobs by specifying path to job class

Example

Setup:

src/main/resources/kadai.properties
kadai.jobs.scheduler.enabled=true
kadai.jobs.scheduler.initialStartDelay=2
kadai.jobs.scheduler.period=3
kadai.jobs.scheduler.periodTimeUnit=HOURS
kadai.jobs.refresh.user.firstRunAt=2017-04-05T18:00:00Z
kadai.jobs.refresh.user.runEvery=P4H

Result (assuming the refresh user job is the only active job):

Local Image