The Camunda engine required Enforce History Time To Live
from 7.20. However, it seems the feature does not work in testing.
Here is the XML configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:test" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<!-- job executor configurations -->
<property name="jobExecutorActivate" value="false" />
<property name="history" value="full" />
<property name="historyTimeToLive" value="P365D" />
<property name="enforceHistoryTimeToLive" value="true"/>
<property name="processEnginePlugins">
<list>
<bean class="org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin" />
<bean class="org.camunda.spin.plugin.impl.SpinProcessEnginePlugin" />
</list>
</property>
</bean>
</beans>
And I try to deploy using @Deployment
annotation and test a BPMN file, the historyTimeToLive
configuration of which is null
. The test runs as the same correct result as it just in 7.19, and there just shows some warning messages:
10:57:34.533 [main] WARN org.camunda.bpm.engine.cfg -- ENGINE-12016 definitionKey: BusinessKeyProcess; You are using the default TTL (Time To Live) of 180 days (six months); the history clean-up feature will delete your data after six months. We recommend adjusting the TTL configuration property aligned with your specific requirements.
Meanwhile, if testing the same BPMN in Spring Boot container, an error occurs and indicates that the istoryTimeToLive
cannot be null:
Caused by: org.camunda.bpm.engine.ParseException: ENGINE-09005 Could not parse BPMN process. Errors:
* History Time To Live cannot be null: History Time To Live cannot be null
I’m not sure whether it is an expected behaviour in testing, just like some other best practices in testing such as disable job executor.