summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-10-20 12:48:44 +0000
committerGerrit Code Review <gerrit@onap.org>2021-10-20 12:48:44 +0000
commit5365faad48bafa61d1dd94a2be23c824a42780cb (patch)
tree1df3715fe4255437f10cc9b44643f38774f37dac /bpmn
parentb94c8572015765a2312839427a71148f4ef37ae3 (diff)
parent35078e2cade2baeef29f3965437582510befec26 (diff)
Merge "Add history ttl to all bpmn's programatically"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 8d6e133a1c..24c9b0f85d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -28,7 +28,10 @@ import javax.annotation.PostConstruct;
import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.repository.Deployment;
import org.camunda.bpm.engine.repository.DeploymentBuilder;
+import org.camunda.bpm.engine.repository.ProcessDefinition;
import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
@@ -76,6 +79,9 @@ public class MSOInfrastructureApplication {
@Value("${mso.async.queue-capacity}")
private int queueCapacity;
+ @Value("${mso.bpmn-history-ttl:14}")
+ private Integer bpmnHistoryTtl;
+
private static final String LOGS_DIR = "logs_dir";
private static final String BPMN_SUFFIX = ".bpmn";
private static final String SDC_SOURCE = "sdc";
@@ -102,8 +108,10 @@ public class MSOInfrastructureApplication {
@PostConstruct
public void postConstruct() {
try {
- DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
+ RepositoryService repositoryService = processEngine.getRepositoryService();
+ DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
deployCustomWorkflows(deploymentBuilder);
+ setBpmnTTL(repositoryService, bpmnHistoryTtl);
} catch (Exception e) {
logger.warn("Unable to invoke deploymentBuilder ", e);
}
@@ -149,4 +157,18 @@ public class MSOInfrastructureApplication {
logger.warn("Unable to deploy custom workflows ", e);
}
}
+
+ private void setBpmnTTL(RepositoryService repositoryService, Integer ttl) {
+ List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
+ for (Deployment deployment : deployments) {
+ List<ProcessDefinition> processDefinitions =
+ repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
+ for (ProcessDefinition processDefinition : processDefinitions) {
+ if (!ttl.equals(processDefinition.getHistoryTimeToLive())) {
+ logger.info("Setting ttl {} for processdefinition {}", ttl, processDefinition.getName());
+ repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinition.getId(), ttl);
+ }
+ }
+ }
+ }
}