X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=bpmn%2Fso-bpmn-tasks%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fso%2Fbpmn%2Finfrastructure%2Fworkflow%2Ftasks%2FWorkflowActionBBTasks.java;h=2e91a52f658452acfa5909084481466c90462d8c;hb=7b4a8742c8ed874b436025d4f7bea43ffbf03805;hp=917039b17beec44ebb51014a7dfeb533b7c8fde3;hpb=69abb1bdca1a042849c72e90a76c39257fdf1a9b;p=so.git diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 917039b17b..2e91a52f65 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -41,6 +41,7 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; @@ -54,6 +55,7 @@ public class WorkflowActionBBTasks { private static final String G_ALACARTE = "aLaCarte"; private static final String G_ACTION = "requestAction"; private static final String RETRY_COUNT = "retryCount"; + protected String maxRetries = "mso.rainyDay.maxRetries"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @Autowired @@ -62,6 +64,8 @@ public class WorkflowActionBBTasks { private WorkflowAction workflowAction; @Autowired private WorkflowActionBBFailure workflowActionBBFailure; + @Autowired + private Environment environment; public void selectBB(DelegateExecution execution) { List flowsToExecute = (List) execution @@ -85,8 +89,8 @@ public class WorkflowActionBBTasks { execution.setVariable("completed", true); } else { execution.setVariable("completed", false); - execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); } + execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); } public void updateFlowStatistics(DelegateExecution execution) { @@ -199,6 +203,7 @@ public class WorkflowActionBBTasks { execution.setVariable("finalStatusMessage", macroAction); Timestamp endTime = new Timestamp(System.currentTimeMillis()); request.setEndTime(endTime); + request.setFlowStatus("Successfully completed all Building Blocks"); request.setStatusMessage(macroAction); request.setProgress(Long.valueOf(100)); request.setRequestStatus("COMPLETE"); @@ -214,17 +219,24 @@ public class WorkflowActionBBTasks { String requestId = (String) execution.getVariable(G_REQUEST_ID); String retryDuration = (String) execution.getVariable("RetryDuration"); int retryCount = (int) execution.getVariable(RETRY_COUNT); + int envMaxRetries; + try{ + envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); + } catch (Exception ex) { + logger.error("Could not read maxRetries from config file. Setting max to 5 retries"); + envMaxRetries = 5; + } int nextCount = retryCount +1; if (handlingCode.equals("Retry")){ workflowActionBBFailure.updateRequestErrorStatusMessage(execution); try{ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - request.setRetryStatusMessage("Retry " + nextCount + "/5 will be started in " + retryDuration); + request.setRetryStatusMessage("Retry " + nextCount + "/" + envMaxRetries + " will be started in " + retryDuration); requestDbclient.updateInfraActiveRequests(request); } catch(Exception ex){ logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex); } - if(retryCount<5){ + if(retryCount