diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-13 10:19:40 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-13 10:19:58 -0500 |
commit | 1e9abc1e59393d85f81b478301cd2918fcd520b8 (patch) | |
tree | 38c5f9792282c720e9a9d0fdef5662848cf5fb71 /bpmn/so-bpmn-tasks/src/main/java | |
parent | 641d9e6b68a964dc69dbec7c63f82e73b61433e2 (diff) |
workflow action should read config for max retries
workflow action should also read config for max retries
Change-Id: Ib0617b59ca95df7c82fb2ab54895c9c83586f02f
Issue-ID: SO-1504
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java | 15 |
1 files changed, 13 insertions, 2 deletions
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 78a84b1772..f6c9597de8 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<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution @@ -215,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<envMaxRetries){ int currSequence = (int) execution.getVariable("gCurrentSequence"); execution.setVariable("gCurrentSequence", currSequence-1); execution.setVariable(RETRY_COUNT, nextCount); |