diff --git a/src/main/java/org/gridsuite/study/server/StudyConstants.java b/src/main/java/org/gridsuite/study/server/StudyConstants.java index e8e67afa8..2efae5f70 100644 --- a/src/main/java/org/gridsuite/study/server/StudyConstants.java +++ b/src/main/java/org/gridsuite/study/server/StudyConstants.java @@ -69,6 +69,7 @@ private StudyConstants() { public static final String HEADER_IMPORT_PARAMETERS = "importParameters"; public static final String HEADER_MESSAGE = "message"; public static final String HEADER_USER_ID = "userId"; + public static final String HEADER_ERROR_MESSAGE = "x-exception-message"; public static final String QUERY_PARAM_ONLY_STASHED = "onlyStashed"; public static final String QUERY_PARAM_STASHED = "stashed"; public static final String QUERY_PARAM_ACTIVATED = "activated"; diff --git a/src/main/java/org/gridsuite/study/server/service/ConsumerService.java b/src/main/java/org/gridsuite/study/server/service/ConsumerService.java index acd9b131b..f719f9570 100644 --- a/src/main/java/org/gridsuite/study/server/service/ConsumerService.java +++ b/src/main/java/org/gridsuite/study/server/service/ConsumerService.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.util.Strings; +import org.gridsuite.study.server.StudyConstants; import org.gridsuite.study.server.dto.*; import org.gridsuite.study.server.dto.caseimport.CaseImportAction; import org.gridsuite.study.server.dto.caseimport.CaseImportReceiver; @@ -164,7 +165,7 @@ public Consumer> consumeBuildFailed() { // send notification UUID studyUuid = networkModificationTreeService.getStudyUuidForNodeId(receiverObj.getNodeUuid()); - notificationService.emitNodeBuildFailed(studyUuid, receiverObj.getNodeUuid(), message.getHeaders().get(HEADER_MESSAGE, String.class)); + notificationService.emitNodeBuildFailed(studyUuid, receiverObj.getNodeUuid(), message.getHeaders().get(StudyConstants.HEADER_ERROR_MESSAGE, String.class)); } catch (JsonProcessingException e) { LOGGER.error(e.toString()); } @@ -409,7 +410,7 @@ public Consumer> consumeCaseImportFailed() { */ public void consumeCalculationFailed(Message msg, ComputationType computationType) { String receiver = msg.getHeaders().get(HEADER_RECEIVER, String.class); - String errorMessage = msg.getHeaders().get(HEADER_MESSAGE, String.class); + String errorMessage = msg.getHeaders().get(StudyConstants.HEADER_ERROR_MESSAGE, String.class); String userId = msg.getHeaders().get(HEADER_USER_ID, String.class); UUID resultUuid = null; // resultUuid is only used for the voltage initialization computation, I don't know why diff --git a/src/main/resources/config/application.yaml b/src/main/resources/config/application.yaml index d446338eb..59c5014fe 100644 --- a/src/main/resources/config/application.yaml +++ b/src/main/resources/config/application.yaml @@ -3,7 +3,6 @@ spring: name: study-server main: allow-circular-references: true - cloud: function: definition: "consumeSaResult;consumeSaStopped;consumeSaFailed;consumeSaCancelFailed;\ @@ -32,8 +31,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.cancelfailed group: studySaCancelFailedGroup consumeSaFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.failed - group: studySaFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.run.dlx + group: dlq consumeDsResult-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}ds.result group: studyDsResultGroup @@ -41,8 +40,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}ds.stopped group: studyDsStoppedGroup consumeDsFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}ds.failed - group: studyDsFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}ds.run.dlx + group: dlq consumeBuildResult-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}build.result group: studyBuildResultGroup @@ -50,8 +49,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}build.stopped group: studyBuildStoppedGroup consumeBuildFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}build.failed - group: studyBuildFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}build.run.dlx + group: dlq consumeLoadFlowResult-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}loadflow.result group: studyLoadFlowResultGroup @@ -59,8 +58,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}loadflow.stopped group: studyLoadFlowStoppedGroup consumeLoadFlowFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}loadflow.failed - group: studyLoadFlowFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}loadflow.run.dlx + group: dlq consumeLoadFlowCancelFailed-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}loadflow.cancelfailed group: studyLoadFlowCancelFailedGroup @@ -71,8 +70,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}sensitivityanalysis.stopped group: studySensitivityAnalysisStoppedGroup consumeSensitivityAnalysisFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}sensitivityanalysis.failed - group: studySensitivityAnalysisFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}sensitivityanalysis.run.dlx + group: dlq consumeSensitivityAnalysisCancelFailed-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}sensitivityanalysis.cancelfailed group: studySensitivityAnalysisCancelFailedGroup @@ -83,8 +82,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.stopped group: studyNonEvacuatedEnergyStoppedGroup consumeNonEvacuatedEnergyFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.failed - group: studyNonEvacuatedEnergyFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.run.dlx + group: dlq consumeNonEvacuatedEnergyCancelFailed-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}nonEvacuatedEnergy.cancelfailed group: studyNonEvacuatedEnergyCancelFailedGroup @@ -95,8 +94,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}shortcircuitanalysis.stopped group: studyShortCircuitAnalysisStoppedGroup consumeShortCircuitAnalysisFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}shortcircuitanalysis.failed - group: studyShortCircuitAnalysisFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}shortcircuitanalysis.run.dlx + group: dlq consumeShortCircuitAnalysisCancelFailed-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}shortcircuitanalysis.cancelfailed group: studyShortCircuitAnalysisCancelFailedGroup @@ -107,8 +106,8 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}voltageinit.stopped group: studyVoltageInitStoppedGroup consumeVoltageInitFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}voltageinit.failed - group: studyVoltageInitFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}voltageinit.run.dlx + group: dlq consumeVoltageInitCancelFailed-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}voltageinit.cancelfailed group: studyVoltageInitCancelFailedGroup @@ -119,14 +118,14 @@ spring: destination: ${powsybl-ws.rabbitmq.destination.prefix:}stateestimation.stopped group: studyStateEstimationStoppedGroup consumeStateEstimationFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}stateestimation.failed - group: studyStateEstimationFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}stateestimation.run.dlx + group: dlq consumeCaseImportSucceeded-in-0: destination: ${powsybl-ws.rabbitmq.destination.prefix:}case.import.succeeded group: studyCaseImportSucceededGroup consumeCaseImportFailed-in-0: - destination: ${powsybl-ws.rabbitmq.destination.prefix:}case.import.failed - group: studyCaseImportFailedGroup + destination: ${powsybl-ws.rabbitmq.destination.prefix:}case.import.start.dlx + group: dlq output-bindings: publishStudyUpdate-out-0;publishElementUpdate-out-0 powsybl: diff --git a/src/test/java/org/gridsuite/study/server/LoadFlowTest.java b/src/test/java/org/gridsuite/study/server/LoadFlowTest.java index 870647602..02e580c30 100644 --- a/src/test/java/org/gridsuite/study/server/LoadFlowTest.java +++ b/src/test/java/org/gridsuite/study/server/LoadFlowTest.java @@ -141,7 +141,7 @@ class LoadFlowTest { private static final String ELEMENT_UPDATE_DESTINATION = "element.update"; private static final String LOADFLOW_RESULT_DESTINATION = "loadflow.result"; private static final String LOADFLOW_STOPPED_DESTINATION = "loadflow.stopped"; - private static final String LOADFLOW_FAILED_DESTINATION = "loadflow.failed"; + private static final String LOADFLOW_FAILED_DESTINATION = "loadflow.run.dlx"; @Autowired private MockMvc mockMvc; diff --git a/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java b/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java index 7ecd342c7..9258399ca 100644 --- a/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java +++ b/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java @@ -71,6 +71,7 @@ import java.util.*; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.gridsuite.study.server.StudyConstants.HEADER_ERROR_MESSAGE; import static org.gridsuite.study.server.StudyConstants.QUERY_PARAM_RECEIVER; import static org.gridsuite.study.server.utils.ImpactUtils.createModificationResultWithElementImpact; import static org.gridsuite.study.server.utils.MatcherCreatedStudyBasicInfos.createMatcherCreatedStudyBasicInfos; @@ -263,7 +264,7 @@ void setup(final MockWebServer server) { .withPostServeAction(POST_ACTION_SEND_INPUT, Map.of("payload", DEFAULT_BUILD_RESULT, "destination", "build.result")) .willReturn(WireMock.ok())).getId(); buildFailedStubId = wireMockServer.stubFor(WireMock.post(WireMock.urlPathEqualTo("/v1/networks/" + NETWORK_UUID_2_STRING + "/build")) - .withPostServeAction(POST_ACTION_SEND_INPUT, Map.of("payload", "", "destination", "build.failed", "message", ERROR_MESSAGE)) + .withPostServeAction(POST_ACTION_SEND_INPUT, Map.of("payload", "", "destination", "build.run.dlx", HEADER_ERROR_MESSAGE, ERROR_MESSAGE)) .willReturn(WireMock.ok())).getId(); buildErrorStubId = wireMockServer.stubFor(WireMock.post(WireMock.urlPathEqualTo("/v1/networks/" + NETWORK_UUID_3_STRING + "/build")) .willReturn(WireMock.serverError())).getId(); diff --git a/src/test/java/org/gridsuite/study/server/NonEvacuatedEnergyTest.java b/src/test/java/org/gridsuite/study/server/NonEvacuatedEnergyTest.java index 215759173..c5bb49c84 100644 --- a/src/test/java/org/gridsuite/study/server/NonEvacuatedEnergyTest.java +++ b/src/test/java/org/gridsuite/study/server/NonEvacuatedEnergyTest.java @@ -154,7 +154,7 @@ class NonEvacuatedEnergyTest { private static final String STUDY_UPDATE_DESTINATION = "study.update"; private static final String NON_EVACUATED_ENERGY_RESULT_DESTINATION = "nonEvacuatedEnergy.result"; private static final String NON_EVACUATED_ENERGY_STOPPED_DESTINATION = "nonEvacuatedEnergy.stopped"; - private static final String NON_EVACUATED_ENERGY_FAILED_DESTINATION = "nonEvacuatedEnergy.failed"; + private static final String NON_EVACUATED_ENERGY_FAILED_DESTINATION = "nonEvacuatedEnergy.run.dlx"; @Autowired private RootNetworkNodeInfoService rootNetworkNodeInfoService; @Autowired diff --git a/src/test/java/org/gridsuite/study/server/SecurityAnalysisTest.java b/src/test/java/org/gridsuite/study/server/SecurityAnalysisTest.java index 9e20f91eb..ffa017473 100644 --- a/src/test/java/org/gridsuite/study/server/SecurityAnalysisTest.java +++ b/src/test/java/org/gridsuite/study/server/SecurityAnalysisTest.java @@ -182,7 +182,7 @@ class SecurityAnalysisTest { private final String studyUpdateDestination = "study.update"; private final String saResultDestination = "sa.result"; private final String saStoppedDestination = "sa.stopped"; - private final String saFailedDestination = "sa.failed"; + private final String saFailedDestination = "sa.run.dlx"; @Autowired private RootNetworkNodeInfoService rootNetworkNodeInfoService; @Autowired diff --git a/src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java b/src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java index 6fbe7431a..615f4f212 100644 --- a/src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java +++ b/src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java @@ -179,7 +179,7 @@ class SensitivityAnalysisTest { private static final String ELEMENT_UPDATE_DESTINATION = "element.update"; private static final String SENSITIVITY_ANALYSIS_RESULT_DESTINATION = "sensitivityanalysis.result"; private static final String SENSITIVITY_ANALYSIS_STOPPED_DESTINATION = "sensitivityanalysis.stopped"; - private static final String SENSITIVITY_ANALYSIS_FAILED_DESTINATION = "sensitivityanalysis.failed"; + private static final String SENSITIVITY_ANALYSIS_FAILED_DESTINATION = "sensitivityanalysis.run.dlx"; private static final byte[] SENSITIVITY_RESULTS_AS_CSV = {0x00, 0x01}; diff --git a/src/test/java/org/gridsuite/study/server/ShortCircuitTest.java b/src/test/java/org/gridsuite/study/server/ShortCircuitTest.java index 59f1119e3..c8ae15b17 100644 --- a/src/test/java/org/gridsuite/study/server/ShortCircuitTest.java +++ b/src/test/java/org/gridsuite/study/server/ShortCircuitTest.java @@ -166,7 +166,7 @@ class ShortCircuitTest implements WithAssertions { private final String elementUpdateDestination = "element.update"; private final String shortCircuitAnalysisResultDestination = "shortcircuitanalysis.result"; private final String shortCircuitAnalysisStoppedDestination = "shortcircuitanalysis.stopped"; - private final String shortCircuitAnalysisFailedDestination = "shortcircuitanalysis.failed"; + private final String shortCircuitAnalysisFailedDestination = "shortcircuitanalysis.run.dlx"; @Autowired private StudyService studyService; diff --git a/src/test/java/org/gridsuite/study/server/StateEstimationTest.java b/src/test/java/org/gridsuite/study/server/StateEstimationTest.java index b98ec4e23..71cc6f2e8 100644 --- a/src/test/java/org/gridsuite/study/server/StateEstimationTest.java +++ b/src/test/java/org/gridsuite/study/server/StateEstimationTest.java @@ -100,7 +100,7 @@ class StateEstimationTest { private static final String STUDY_UPDATE_DESTINATION = "study.update"; private static final String ESTIM_RESULT_JSON_DESTINATION = "stateestimation.result"; private static final String ESTIM_STOPPED_DESTINATION = "stateestimation.stopped"; - private static final String ESTIM_FAILED_DESTINATION = "stateestimation.failed"; + private static final String ESTIM_FAILED_DESTINATION = "stateestimation.run.dlx"; @Autowired private MockMvc mockMvc; diff --git a/src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java b/src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java index 6987a9079..152ff5a75 100644 --- a/src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java +++ b/src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java @@ -202,7 +202,7 @@ class StudyControllerDynamicSimulationTest { private static final String STUDY_UPDATE_DESTINATION = "study.update"; private static final String DS_RESULT_DESTINATION = "ds.result"; private static final String DS_STOPPED_DESTINATION = "ds.stopped"; - private static final String DS_FAILED_DESTINATION = "ds.failed"; + private static final String DS_FAILED_DESTINATION = "ds.run.dlx"; @BeforeEach public void setup() { diff --git a/src/test/java/org/gridsuite/study/server/StudyTest.java b/src/test/java/org/gridsuite/study/server/StudyTest.java index 77c1eeaf2..3daf74d98 100644 --- a/src/test/java/org/gridsuite/study/server/StudyTest.java +++ b/src/test/java/org/gridsuite/study/server/StudyTest.java @@ -676,7 +676,7 @@ private void sendCaseImportFailedMessage(String requestPath, String errorMessage String receiverUrlString = matcher.group(1); input.send(MessageBuilder.withPayload("").setHeader("receiver", URLDecoder.decode(receiverUrlString, StandardCharsets.UTF_8)) .setHeader("errorMessage", errorMessage) - .build(), "case.import.failed"); + .build(), "case.import.start.dlx"); } } diff --git a/src/test/java/org/gridsuite/study/server/VoltageInitTest.java b/src/test/java/org/gridsuite/study/server/VoltageInitTest.java index 318edc5a1..7e055ddda 100644 --- a/src/test/java/org/gridsuite/study/server/VoltageInitTest.java +++ b/src/test/java/org/gridsuite/study/server/VoltageInitTest.java @@ -223,7 +223,7 @@ class VoltageInitTest { private final String studyUpdateDestination = "study.update"; private final String voltageInitResultDestination = "voltageinit.result"; private final String voltageInitStoppedDestination = "voltageinit.stopped"; - private final String voltageInitFailedDestination = "voltageinit.failed"; + private final String voltageInitFailedDestination = "voltageinit.run.dlx"; private final String voltageInitCancelFailedDestination = "voltageinit.cancelfailed"; private final String elementUpdateDestination = "element.update"; @Autowired