aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/mso-infrastructure-bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java19
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java19
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java11
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java84
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java59
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml15
8 files changed, 148 insertions, 69 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
index 7c0c2f20b3..13ba46a852 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
import org.camunda.bpm.engine.OptimisticLockingException;
import org.camunda.bpm.engine.RuntimeService;
@@ -207,7 +208,7 @@ public class CallbackHandlerService {
+ messageEventName + " with " + correlationVariable + " = '" + correlationValue
+ "'; last exception was:" + queryException;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg, queryException);
}
@@ -245,8 +246,8 @@ public class CallbackHandlerService {
String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
+ " with " + correlationVariable + " = '" + correlationValue + "': " + ole;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- ErrorCode.UnknownError.getValue(), msg, ole);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "BPMN CORRELATION ERROR -", ErrorCode.UnknownError.getValue(), msg, ole);
// Retry for OptimisticLocking Exceptions
int retryCount = 0;
@@ -279,7 +280,7 @@ public class CallbackHandlerService {
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:"
+ retryCount + " | exception returned: " + olex;
logger.debug(strMsg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), strMsg, olex);
} catch (Exception excep) {
retryCount = 0;
@@ -287,7 +288,7 @@ public class CallbackHandlerService {
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:"
+ retryCount + " | exception returned: " + excep;
logger.debug(strMsg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), strMsg, excep);
}
@@ -300,7 +301,7 @@ public class CallbackHandlerService {
+ " after receiving " + messageEventName + " with " + correlationVariable + " = '"
+ correlationValue + "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg, e);
}
} catch (Exception e) {
@@ -309,7 +310,7 @@ public class CallbackHandlerService {
String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + " with "
+ correlationVariable + " = '" + correlationValue + "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
ErrorCode.UnknownError.getValue(), msg, e);
}
@@ -345,10 +346,10 @@ public class CallbackHandlerService {
*/
protected void logCallbackError(String method, long startTime, String msg, Exception e) {
if (e == null) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg);
} else {
- logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg, e);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
index 1e9ebdf0b2..f76fde9ef1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -32,6 +32,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
import org.onap.so.logger.ErrorCode;
@@ -78,7 +79,7 @@ public class WorkflowMessageResource {
if (messageType == null || messageType.isEmpty()) {
String msg = "Missing message type";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
@@ -86,7 +87,7 @@ public class WorkflowMessageResource {
if (correlator == null || correlator.isEmpty()) {
String msg = "Missing correlator";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
index 9d63e8eaf1..20f3eb4fee 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
@@ -36,6 +36,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.ProcessEngineServices;
@@ -195,7 +196,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
if (processInstance != null)
workflowResponse.setProcessInstanceID(processInstance.getId());
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + workflowResponse.getMessage()
+ " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
@@ -581,7 +582,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
response.setResponse("Failed to retrieve the variables," + ex.getMessage());
response.setProcessInstanceID(processInstanceId);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + response.getMessage()
+ " for processKey: " + processKey + " with response: " + response.getResponse());
logger.debug("Exception :", ex);
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index 296ab64df3..251464a34d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -22,16 +22,8 @@
package org.onap.so.bpmn.core.plugins;
-import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
@@ -39,26 +31,15 @@ import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
-import org.camunda.bpm.engine.impl.context.Context;
-import org.camunda.bpm.engine.impl.interceptor.Command;
-import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.util.xml.Element;
import org.camunda.bpm.engine.impl.variable.VariableDeclaration;
-import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl;
-import org.camunda.bpm.model.bpmn.instance.EndEvent;
-import org.camunda.bpm.model.bpmn.instance.FlowNode;
-import org.camunda.bpm.model.bpmn.instance.StartEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.AbstractEnvironment;
-import org.springframework.core.env.Environment;
-import org.springframework.core.env.MapPropertySource;
-import org.springframework.core.env.PropertySource;
import org.springframework.stereotype.Component;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
index ab21c0807e..42c6ef059f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
@@ -32,7 +32,6 @@ import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior;
import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
-import org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration;
import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
@@ -58,6 +57,8 @@ import org.slf4j.LoggerFactory;
public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
+ private static final String WORKFLOW_EXCEPTION = "WorkflowException";
+
@Override
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
@@ -131,7 +132,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
*/
public static class WorkflowExceptionResetListener implements ExecutionListener {
public void notify(DelegateExecution execution) throws Exception {
- Object workflowException = execution.getVariable("WorkflowException");
+ Object workflowException = execution.getVariable(WORKFLOW_EXCEPTION);
if (workflowException instanceof WorkflowException) {
int index = 1;
@@ -140,10 +141,10 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
saveName = "SavedWorkflowException" + (++index);
}
- logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
+ logger.debug("WorkflowExceptionResetTask is moving WorkflowException to {}", saveName);
execution.setVariable(saveName, workflowException);
- execution.setVariable("WorkflowException", null);
+ execution.setVariable(WORKFLOW_EXCEPTION, null);
}
}
}
@@ -153,7 +154,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
*/
public static class WorkflowExceptionTriggerTask implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
- if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ if (execution.getVariable(WORKFLOW_EXCEPTION) instanceof WorkflowException) {
logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
throw new BpmnError("MSOWorkflowException");
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java
new file mode 100644
index 0000000000..686b377727
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure;
+
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"})
+@Profile({"!test"})
+public class CamundaDBConfig {
+
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig camundaDbConfig() {
+ return new HikariConfig();
+ }
+
+ @Primary
+ @Bean(name = "dataSource")
+ public DataSource dataSource() {
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean("dataSource");
+ }
+ HikariConfig hikariConfig = this.camundaDbConfig();
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("dataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
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 c61808ebb1..093fba089d 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
@@ -24,14 +24,15 @@ package org.onap.so.bpmn.infrastructure;
import java.util.List;
import java.util.concurrent.Executor;
-import org.camunda.bpm.application.PostDeploy;
+import org.onap.so.logger.LoggingAnchor;
+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.repository.DeploymentBuilder;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
-import org.onap.so.db.catalog.data.repository.WorkflowRepository;
+import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,13 +40,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Primary;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@@ -56,17 +55,17 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication
@EnableAsync
-@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
-@EntityScan({"org.onap.so.db.catalog.beans"})
@ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOInfrastructureApplication {
private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
+ @Autowired
+ private ProcessEngine processEngine;
@Autowired
- private WorkflowRepository workflowRepository;
+ private CatalogDbClient catalogDbClient;
@Value("${mso.async.core-pool-size}")
private int corePoolSize;
@@ -79,6 +78,7 @@ public class MSOInfrastructureApplication {
private static final String LOGS_DIR = "logs_dir";
private static final String BPMN_SUFFIX = ".bpmn";
+ private static final String SDC_SOURCE = "sdc";
private static void setLogsDir() {
@@ -93,10 +93,14 @@ public class MSOInfrastructureApplication {
setLogsDir();
}
- @PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {
- DeploymentBuilder deploymentBuilder = processEngineInstance.getRepositoryService().createDeployment();
- deployCustomWorkflows(deploymentBuilder);
+ @PostConstruct
+ public void postConstruct() {
+ try {
+ DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
+ deployCustomWorkflows(deploymentBuilder);
+ } catch (Exception e) {
+ logger.warn("Unable to invoke deploymentBuilder: " + e.getMessage());
+ }
}
@PreUndeploy
@@ -117,23 +121,26 @@ public class MSOInfrastructureApplication {
}
public void deployCustomWorkflows(DeploymentBuilder deploymentBuilder) {
- if (workflowRepository == null) {
- return;
- }
- List<Workflow> workflows = workflowRepository.findAll();
- if (workflows != null && workflows.size() != 0) {
- for (Workflow workflow : workflows) {
- String workflowName = workflow.getName();
- String workflowBody = workflow.getBody();
- if (!workflowName.endsWith(BPMN_SUFFIX)) {
- workflowName += BPMN_SUFFIX;
- }
- if (workflowBody != null) {
- logger.info("{} {}", "Deploying custom workflow", workflowName);
- deploymentBuilder.addString(workflowName, workflowBody);
+ logger.debug("Attempting to deploy custom workflows");
+ try {
+ List<Workflow> workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE);
+ if (workflows != null && !workflows.isEmpty()) {
+ for (Workflow workflow : workflows) {
+ String workflowName = workflow.getName();
+ String workflowBody = workflow.getBody();
+ if (!workflowName.endsWith(BPMN_SUFFIX)) {
+ workflowName += BPMN_SUFFIX;
+ }
+ if (workflowBody != null) {
+ logger.info(LoggingAnchor.TWO, "Deploying custom workflow", workflowName);
+ deploymentBuilder.addString(workflowName, workflowBody);
+ }
+ deploymentBuilder.enableDuplicateFiltering(true);
+ deploymentBuilder.deploy();
}
}
- deploymentBuilder.deploy();
+ } catch (Exception e) {
+ logger.warn("Unable to deploy custom workflows, " + e.getMessage());
}
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
index a91cb9d88d..185db168fe 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
@@ -4,13 +4,16 @@ server:
max-threads: 50
mso:
infra:
- auditInventory: true
+ auditInventory: false
spring:
datasource:
- driver-class-name: org.mariadb.jdbc.Driver
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
- username: ${DB_ADMIN_USERNAME}
- password: ${DB_ADMIN_PASSWORD}
+ hikari:
+ jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
+ username: ${DB_ADMIN_USERNAME}
+ password: ${DB_ADMIN_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: bpmn-pool
+ registerMbeans: true
http:
multipart:
enabled: false
@@ -36,4 +39,4 @@ management:
export:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
- step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file
+ step: 1m # Step size (i.e. reporting frequency) to use.