How to disable history in spring activiti

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
yaswanthbsactiv
Active Member

How to disable history in spring activiti

Jump to solution

Hi Everyone,

I am using Activiti with spring boot, I am facing few performance issues while getting the data from the activiti tables this is due to the history tables I guess.

When I am querying for the data from the activiti tables, in the 1st scenario it took 0.239 seconds to get the result but in the 2nd scenario it took 1.884 seconds to fetch the data from the database.

Table NameTotal records available (1st scenario)Total records available (2nd scenario)
act_ge_bytearray
21777162
act_hi_actinst
245216702
act_hi_identitylink
12548409
act_hi_procinst
4073569
act_hi_taskinst
12548409
act_hi_varinst
4073569

This is the main reason, I want to disable the history. 

Tech stack:

Spring Activiti - 5.22.0

Spring Boot version - 1.5.8.Release

MyBatis for ORM

Please let me know, Is there any configuration to disable the history and will be there any problems if we disable the history.

Regards

Yashu

@ Edited

I tried the below code, which I kept it in springboot configuration class. Still no luck.

@Bean
public ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
SpringProcessEngineConfiguration processEngineConf = new SpringProcessEngineConfiguration();
processEngineConf.setHistory(HistoryLevel.NONE.getKey());
return processEngineConf;
}

1 Solution

Accepted Solutions
yaswanthbsactiv
Active Member

Re: How to disable history in spring activiti

Jump to solution

I got solution for the problem which I am facing. Below is the code which is the solution which worked for me.

@Autowired
private SpringProcessEngineConfiguration config;

@GetMapping("/startProcess")
public String startProcess() {
config.setHistoryLevel(HistoryLevel.NONE);
System.out.println(config.getHistoryLevel());
RuntimeService runtimeService = config.getRuntimeService();
runtimeService.startProcessInstanceByKey("testing_DeletingHistory", "start");

Thanks everyone. Smiley Happy

View solution in original post

3 Replies
pault
Active Member II

Re: How to disable history in spring activiti

Jump to solution

Not sure about the Spring equivalent but In version 5.22, and using the Java API, I create an engine using a configuration created via ProcessEngineConfiguration.createProcessEngineConfigurationFromResource() which takes an XML config file with the line <property name="history" value="none"/>. This does turn the history off, and everything works fine, unless you are relying on the history tables of course. History can impact performance as you suspect. 

yaswanthbsactiv
Active Member

Re: How to disable history in spring activiti

Jump to solution

Thanks PaulT _‌ .

yaswanthbsactiv
Active Member

Re: How to disable history in spring activiti

Jump to solution

I got solution for the problem which I am facing. Below is the code which is the solution which worked for me.

@Autowired
private SpringProcessEngineConfiguration config;

@GetMapping("/startProcess")
public String startProcess() {
config.setHistoryLevel(HistoryLevel.NONE);
System.out.println(config.getHistoryLevel());
RuntimeService runtimeService = config.getRuntimeService();
runtimeService.startProcessInstanceByKey("testing_DeletingHistory", "start");

Thanks everyone. Smiley Happy

View solution in original post