summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2022-08-31 13:45:15 +0000
committerGerrit Code Review <gerrit@onap.org>2022-08-31 13:45:15 +0000
commit66b09af14e0a2cf774e9f917562f4ae54587eb19 (patch)
treeeaa03610d63a864351933d58b3cfe1a52feb8469 /bpmn/so-bpmn-tasks/src/main
parentea65e0397e030bbd0a685f473b1c8416dd0a82f3 (diff)
parent5baa1ed97c1d2b98952a025c3bc76f60587e9670 (diff)
Merge "Enable long-running processes in ControllerExecutionBB"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
index 92be824691..c5536106fe 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
@@ -26,11 +26,13 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
import org.onap.so.bpmn.infrastructure.decisionpoint.impl.AbstractControllerExecution;
+import org.onap.so.client.cds.PayloadConstants;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
@@ -52,8 +54,11 @@ public class ControllerExecutionBB extends AbstractControllerExecution<BuildingB
@Autowired
protected CatalogDbClient catalogDbClient;
+ @Value("${controller-execution.timeout-for-controller-message:P1D}")
+ private String timeoutForControllerMessage;
public void execute(final BuildingBlockExecution execution) {
+ execution.setVariable(PayloadConstants.TIMEOUT_CONTROLLER_MESSAGE, timeoutForControllerMessage);
ControllerContext<BuildingBlockExecution> controllerContext = buildControllerContext(execution);
controllerExecute(controllerContext);
}
@@ -151,4 +156,18 @@ public class ControllerExecutionBB extends AbstractControllerExecution<BuildingB
"Unable to find the controller implementation", ONAPComponents.SO);
}
}
+
+ public void handleFailure(final BuildingBlockExecution execution) {
+ String errorMessage = execution.getVariable(PayloadConstants.CONTROLLER_ERROR_MESSAGE);
+
+ if (Boolean.TRUE.equals(execution.getVariable(PayloadConstants.CONTROLLER_MSG_TIMEOUT_REACHED))) {
+ logger.error(
+ "timeout-for-controller-message was reached. If the controller is still processing, this property should be reconfigured");
+ errorMessage = "Controller response was not received within configured timeout";
+ } else if (errorMessage == null) {
+ errorMessage = "Controller call failed. No errormessage was captured.";
+ }
+
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 9003, errorMessage, ONAPComponents.SO);
+ }
}