diff options
author | Boslet, Cory <cory.boslet@att.com> | 2020-11-03 12:01:12 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-11-03 12:01:13 -0500 |
commit | 9630dd840fac8977329d7ff2dacc96e6db31248d (patch) | |
tree | b02fe060a5e516ad4c26c6488e6e71c8ddf045ba /adapters | |
parent | 5f49f69b09a9ec8d83d6cc38ee672b355de20013 (diff) |
Added to handle inventory failure errors in bpmn.
Added to handle inventory failure errors in bpmn.
Issue-ID: SO-3358
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ia578a4e629ac816c79338fbfff7717ad348e9bc4
Diffstat (limited to 'adapters')
6 files changed, 22 insertions, 12 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java index b176892192..4e0c4ad8a6 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java @@ -62,13 +62,13 @@ public class TaskServices { public void createtAAIInventory() throws Exception { for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); - client.subscribe("InventoryCreate").lockDuration(externalTaskServiceUtils.getLongLockDuration()) + client.subscribe("InventoryCreate").lockDuration(externalTaskServiceUtils.getLockDurationMedium()) .handler(createInventory::executeExternalTask).open(); } } @PostConstruct - public void auditAAIInventory() throws Exception { + public void deleteAAIInventory() throws Exception { for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { externalTaskServiceUtils.createExternalTaskClient().subscribe("InventoryDelete") .lockDuration(externalTaskServiceUtils.getLockDurationMedium()) @@ -80,7 +80,7 @@ public class TaskServices { public void openstackInvoker() throws Exception { for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); - client.subscribe("OpenstackAdapterInvoke").lockDuration(externalTaskServiceUtils.getLockDuration()) + client.subscribe("OpenstackAdapterInvoke").lockDuration(externalTaskServiceUtils.getLockDurationShort()) .handler(stackService::executeExternalTask).open(); } } @@ -89,7 +89,7 @@ public class TaskServices { public void openstackPoller() throws Exception { for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); - client.subscribe("OpenstackAdapterPolling").lockDuration(externalTaskServiceUtils.getLockDuration()) + client.subscribe("OpenstackAdapterPolling").lockDuration(externalTaskServiceUtils.getLockDurationMedium()) .handler(pollService::executeExternalTask).open(); } } @@ -98,7 +98,7 @@ public class TaskServices { public void openstackRollback() throws Exception { for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); - client.subscribe("OpenstackAdapterRollback").lockDuration(externalTaskServiceUtils.getLockDuration()) + client.subscribe("OpenstackAdapterRollback").lockDuration(externalTaskServiceUtils.getLockDurationShort()) .handler(rollbackService::executeExternalTask).open(); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java index 3c9a4833ae..711394a95d 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java @@ -22,6 +22,8 @@ package org.onap.so.adapters.tasks.inventory; +import java.util.HashMap; +import java.util.Map; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; @@ -57,6 +59,7 @@ public class CreateInventoryTask extends ExternalTaskUtils { public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { mdcSetup.setupMDC(externalTask); + Map<String, Object> variables = new HashMap<>(); String externalTaskId = externalTask.getId(); CloudInformation cloudInformation = externalTask.getVariable("cloudInformation"); boolean success = true; @@ -69,6 +72,7 @@ public class CreateInventoryTask extends ExternalTaskUtils { } catch (Exception e) { logger.error("Error during inventory of stack", e); success = false; + variables.put("inventoryErrorMessage", e.getMessage()); } mdcSetup.setElapsedTime(); if (success) { @@ -84,7 +88,8 @@ public class CreateInventoryTask extends ExternalTaskUtils { externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000); } else if (retryCount != null && retryCount - 1 == 0) { - externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE, AAI_INVENTORY_FAILURE, + variables); mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); logger.error("The External Task {} Failed, All Retries Exhausted", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteInventoryTask.java index 08361bdbbf..aad517129f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteInventoryTask.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteInventoryTask.java @@ -22,6 +22,8 @@ package org.onap.so.adapters.tasks.inventory; +import java.util.HashMap; +import java.util.Map; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; @@ -56,6 +58,7 @@ public class DeleteInventoryTask extends ExternalTaskUtils { public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { mdcSetup.setupMDC(externalTask); + Map<String, Object> variables = new HashMap<>(); String externalTaskId = externalTask.getId(); CloudInformation cloudInformation = externalTask.getVariable("cloudInformation"); boolean success = true; @@ -66,6 +69,7 @@ public class DeleteInventoryTask extends ExternalTaskUtils { } catch (Exception e) { logger.error("Error during inventory of stack", e); success = false; + variables.put("inventoryErrorMessage", e.getMessage()); } mdcSetup.setElapsedTime(); if (success) { @@ -81,7 +85,8 @@ public class DeleteInventoryTask extends ExternalTaskUtils { externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000); } else if (retryCount != null && retryCount - 1 == 0) { - externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE, AAI_INVENTORY_FAILURE, + variables); mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); logger.error("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java index 9ff50e8644..6a5381cf3e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java @@ -68,7 +68,7 @@ public class PollService extends ExternalTaskUtils { public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { mdcSetup.setupMDC(externalTask); - logger.trace("Executing External Task Poll Service"); + logger.debug("Starting External Task Poll Service"); Map<String, Object> variables = new HashMap<>(); MutableBoolean success = new MutableBoolean(); String errorMessage = null; @@ -103,11 +103,11 @@ public class PollService extends ExternalTaskUtils { } } catch (Exception e) { logger.error("Error during External Task Poll Service", e); - errorMessage = e.getMessage(); + errorMessage = e.toString(); + variables.put("openstackAdapterErrorMessage", errorMessage); } variables.put("OpenstackPollSuccess", success.booleanValue()); - variables.put("openstackAdapterErrorMessage", errorMessage); if (success.isTrue()) { externalTaskService.complete(externalTask, variables); logger.debug("The External Task Id: {} Successful", externalTask.getId()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java index 15e6ff581d..c25d752cc4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java @@ -39,7 +39,7 @@ public class RollbackService extends ExternalTaskUtils { public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { mdcSetup.setupMDC(externalTask); - logger.trace("Executing External Task Rollback Service"); + logger.debug("Starting External Task Rollback Service"); Map<String, Object> variables = new HashMap<>(); boolean success = false; boolean pollRollbackStatus = false; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java index 5196ffffda..c9fa30d949 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java @@ -91,7 +91,7 @@ public class StackService extends ExternalTaskUtils { Map<String, Object> variables = new HashMap<>(); mdcSetup.setupMDC(externalTask); String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest"); - logger.debug("Executing External Task Stack Service. {}", xmlRequest); + logger.debug("Starting External Task Stack Service. {}", xmlRequest); MutableBoolean success = new MutableBoolean(); MutableBoolean backout = new MutableBoolean(); String response = ""; |