In jBPM there are out-of-the-box jobs that can be used to keep the activated, for example, to maintain a status of the environment health. Let’s check some of them.
The available job commands source code is available at: https://github.com/kiegroup/jbpm/tree/master/jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/commands
ExecutionErrorCleanupCommand : process execution errors are stored into database tables. This Job takes care of these tables cleaning them according to the configuration provided by the user. When activated without further customization, it will be triggered once a day.
LogCleanupCommand: jBPM uses a series of audit tables in order to keep historical process data. For example, once a process is completed, it’s data will be stored in an audit database table. When an environment is running for a long time or the audit tables are starting to get too big, it is important to set up a job to maintain the audit environmental health.
This job will take care of processes audit logs, tasks audit logs, and the job executor related data. By default, it runs once a day starting at the moment when it was scheduled.
SLATrackingCommand: in jBPM, it is possible to set an expected period to finish a process execution. It is called, SLA. SLATrackingCommand is a job that can identify all processes which have SLA violation and send them a signal. When the user wants to take further actions based on process SLA violation, it is possible to use this job along with a signal event which captures the “slaViolation” signal and take further actions.
Configuration
Here follow some possible ways to customize the default jobs that comes along with jBPM. Details can be obtained in each respective class code implementation.
ExecutionErrorCleanupCommand
Possible configuration:
SingleRun | Should be set to true, if should be executed once |
NextRun | Definition of the next execution time. Accepts ISO-8601 date time format (yyyy-MM-dd’T’HH:mm:ss) |
OlderThan | Delete errors older than a given date.Accepts ISO-8601 date time format. |
OlderThanPeriod | Delete errors older than a given period. Accepts ISO-8601 period format, i.e. 10d, 1h. |
ForProcess | Delete only errors related to a given process definition; |
ForProcessInstance | Delete only errors related to a given process instance; |
ForDeployment | Delete only errors related to a given deployment id; |
LogCleanupCommand:
Possible configuration:
SkipProcessLog | Should process logs clean up should be skipped? Valid values: true or false |
SkipTaskLog | Should task logs clean up should be skipped? Valid values: true or false |
SkipExecutorLog | Should job executor logs clean up should be skipped? Valid values: true or false |
SingleRun | Should be set to true, if should be executed once |
NextRun | Definition of the next execution time. Accepts ISO-8601 date time format (yyyy-MM-dd’T’HH:mm:ss) |
OlderThan | Delete errors older than a given date. Accepts ISO-8601 date time format. |
OlderThanPeriod | Delete errors older than a given period. AcceptsISO-8601 period format, i.e. 10d, 1h. |
ForProcess | Delete only logs related to a given process definition; |
ForDeployment | Delete only logs related to a given deployment id; |
SLATrackingCommand
Possible configuration:
SingleRun | Should be set to true, if should be executed once |
NextRun | Definition of the next execution time. Accepts ISO-8601 date time format (yyyy-MM-dd’T’HH:mm:ss) |
ForDeployment | Triggers a signal only for SLA violations related to a given deployment id; |
2 thoughts on “[jBPM7 QuickTips] Native Jobs”