Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This article describes the scheduled job that regularly cleans up the the process history of Activiti. Finished processes are automatically removed from the database to improve performance and save disk space. This is used in Smart ID Identity Manager.

...

Configure Activiti process cleanup

In system.properties, you set up:

  • a Cron expression stating when the job shall run, for example, every Friday at 11 pm

  • a "buffer time", stating after how many days a finished or inactive process shall be deleted

This is an example:

Example: system.properties settings
Code Block
# Age of history entries in days, after which finished task should be deleted
activitiHistoryCleaner.daysAfterEndTime=30
 
# Age of history entries in days, after which inactive task
# (i.e. unfinished task, which are untouched for daysAfterEndTime days) should be deleted
activitiHistoryCleaner.daysOfInactivity=180
 
# Cron expression, when the cleanup task should run. Here every friday at 11 pm
activitiHistoryCleanerJobTrigger.cronExpression = 0 0 23 ? * FRI *

If these parameters are not set, then there are default values set in the process_execution-beans.xml.

...

Logging

A log file named nexus_activiti_history_cleanup.log is generated. It logs the history data that was deleted.

...

Used Activiti services

These Activiti services are used to perform the cleanup task:

  • HistoryService: Queries for finished process instances and deletes them

  • TaskService. Queries for inactive process instances

  • ManagementService: Queries for stuck process instances (asynchronous tasks, that have no retries left)

  • RuntimeService: Deletes process instances, which are returned by TaskService and ManagementService

...

Affected database tables

These are the affected database tables:

Database table

Description

ACT_HI_PROCINST

  • ACT_HI_ACTINST

  • ACT_HI_ATTACHMENT

  • ACT_HI_COMMENT

  • ACT_HI_DETAIL

  • ACT_HI_IDENTITYLINK

  • ACT_HI_TASKINST

  • ACT_HI_VARINST

For all processes that have been finished for X-days ((END_ACT_ID_ is not null) AND (END_TIME_ >= current date - X-days after finishing)

ACT_GE_BYTEARRAY:

General files, that are related to the specific process

ACT_RU_JOB

For all processes that will not run anymore and all related data. -> (RETRIES_ <= 0)

ACT_RU_TASK

For all unfinished processes where no user interaction has occurred in X-days (daysOfInactivity property)