History Cleaning not working. [6.5.0]

I tried two ways to do that:

  1. adding

flowable.enable-history-cleaning=true
flowable.history-cleaning-after-days= 1
flowable.history-cleaning-cycle=0 0 11 ? * MON,TUE,WED,THU,FRI *

to my .properties file and restarted my flowable application. I have about a dozen of process instances that ended more than 24 hours ago. My expectation was that by 11:05 all these finished process instances will be deleted, but I can still see them in my flowable-admin app.

  1. next I tried modifying my @SpringBootApplication class. Here’s how it looks now:

@SpringBootApplication
public class FlowableEventRegistryApplication {
private final RepositoryService repositoryService;
private final EventRepositoryService eventRepositoryService;

public FlowableEventRegistryApplication(RepositoryService repositoryService, EventRepositoryService eventRepositoryService) {
    this.repositoryService = repositoryService;
    this.eventRepositoryService = eventRepositoryService;
}

@Autowired
ProcessEngineConfigurationImpl processEngineConfiguration;

public static void main(String[] args) {
    SpringApplication.run(FlowableEventRegistryApplication.class, args);
}

@PostConstruct
public void init() {
    processEngineConfiguration.setEnableHistoryCleaning(true);
    processEngineConfiguration.setHistoryCleaningTimeCycleConfig("0 30 11 ? * MON,TUE,WED,THU,FRI *");
    processEngineConfiguration.setCleanInstancesEndedAfterNumberOfDays(1);
}

@EventListener(ApplicationStartedEvent.class)
public void started() {}

}

Restarting the application and checking process instances after 11:30 showed that >24hours old instances are still there.

Am I missing something here ? Why don’t they get deleted ?

Both options look ok. If it’s enabled, there should be a timer job being created with a duedate the first time the cron expression would fire. Do you see that timer job through flowable admin?


Yes, there is a timer job. At 12PM 24.09 it created a new one for 12PM 25.09, but the old process instances are still there.

Hi,

I was having the same problem and resolved it with the below postconstruct (example for one month):

    @PostConstruct
	public void init() {
		
		Calendar cal = new GregorianCalendar();
		cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) - 1);
		
		processEngineConfiguration.setEnableHistoryCleaning(true);
		
		historyCleaningManager = new DefaultHistoryCleaningManager(processEngineConfiguration);
		historyCleaningManager.createHistoricProcessInstanceCleaningQuery().finishedBefore(cal.getTime())
		  .delete();
		
		processEngineConfiguration.setHistoryCleaningManager(historyCleaningManager);
	}

Not specifing the historycleaningmanager, was throwing me the error ‘No job handler registered for type cmmn-history-cleanup in job config for engine: bpmn’ (visible in the DeadLetterJobs list)

Hope this helps anyone!

Cheers!