添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
没读研的菠萝  ·  解决spring data jpa ...·  1 年前    · 
威武的罐头  ·  Tee-Object ...·  2 年前    · 
奔放的松树  ·  PHP中的json_encode和json_ ...·  2 年前    · 

need to set TTL using Java API.
I have special config, which use ProcessEnginePlugin and implement 3 hooks: preInit , postInit , postProcessEngineBuild .

And i am trying to config ProcessEngine bean from context. Set all batches and TTL’s.

        processEngineConfiguration.setCustomIncidentHandlers(customIncidentHandlers);
        processEngineConfiguration
        .setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_END)
        .setHistoryRemovalTimeProvider(new DefaultHistoryRemovalTimeProvider())
        .initHistoryRemovalTime();
processEngineConfiguration.setHistoryCleanupStrategy(HISTORY_CLEANUP_STRATEGY_REMOVAL_TIME_BASED);
processEngineConfiguration.setHistoryCleanupBatchSize(MAX_BATCH_SIZE);
processEngineConfiguration.setHistoryCleanupBatchWindowStartTime(null);
processEngineConfiguration.setHistoryCleanupDegreeOfParallelism(1);
processEngineConfiguration.setBatchOperationHistoryTimeToLive(null);
processEngineConfiguration.setBatchOperationsForHistoryCleanup(null);
processEngineConfiguration.setBatchOperationHistoryTimeToLive("3");
processEngineConfiguration.initHistoryCleanup();   

I found this code here. And there is also no method engineConfiguration.setHistoryTimeToLive(TTL).

Okay, definition compiles, but nothing happened.

And also trying to execute in hooks example:
processEngine.getRepositoryService().updateProcessDefinitionHistoryTimeToLive(processDefinitionId, TTL);

I cannot do this, because need processDefinitionId from runtime. And my plugin hooks don’t handle process events.

How can i configure TTL using Java API?

@Sland which camunda version are you using?

I was able to configure in both SpringProcessEngineConfiguration and StandaloneProcessEngineConfiguration

SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
config.setHistoryTimeToLive(historyTimeToLive);
StandaloneProcessEngineConfiguration configuration2 = new StandaloneProcessEngineConfiguration();
configuration2.setHistoryTimeToLive(historyTimeToLive);

Also, you can set it via rest api also and in bpmn model also you can configure it.

https://docs.camunda.org/manual/7.11/reference/deployment-descriptors/tags/process-engine/

@aravindhrs We are using 7.10 version. And it is now possible to set ttl via REST, because we cannot use REST API.

I have config from context, so, this process engine takes from method params. ProcessEngineConfigurationImpl.

Yes, i am already checked StandaloneProcessEngineConfiguration and SpringProcessEngineConfiguration. For my case there is no method setHistoryTimeToLive. It’s strange.

@aravindhrs Okay, thank you, i will try and notify about result.

And one more question. If I want to delete history data, is it enough for me to have only one TTL parameter?Or cleanup strategy required? Because i can set TTL using bpmn files of processes. But in ACT_HI_PROCINST database there is only start time (show attachment). So, can you clarify this information. please?

setHistoryTimeToLive at process engine level applicable across all process definitions. Instead if you want to configure different TTL at process definition level you can configure it in bpmn file itself. Even you can narrow down to specific process instance level to set TTL. It’s upto you which level you want to set TTL. e.g, ProcessEngine level/Process definition level/Process instance level.

aravindhrs:

setHistoryTimeToLive at process engine level applicable across all process definition

@aravindhrs

setHistoryTimeToLive at process engine level applicable across all process definition

Yes, it’s correct case for me. And version 7.11 works. But another my question about cleanup strategy above comment. Please, can you check it?