From ac11f95343378a32e568e4c89b1ba9b6864a090f Mon Sep 17 00:00:00 2001 From: Vincenzo Ingenito Date: Thu, 19 Sep 2024 11:02:55 +0200 Subject: [PATCH] fix:Change kafka key --- .../controller/impl/PublicationCTL.java | 17 +++++++++-------- .../dto/ValidationCreationInputDTO.java | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/impl/PublicationCTL.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/impl/PublicationCTL.java index 8894c257..ee40b6df 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/impl/PublicationCTL.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/impl/PublicationCTL.java @@ -211,17 +211,18 @@ private void postExecutionCreate(final Date startDateOperation, final LogTraceIn priorityType = Boolean.TRUE.equals(out.getPriorita()) ? PriorityTypeEnum.HIGH : PriorityTypeEnum.LOW; } } + + String idDoc = validationInfo.getJsonObj().getIdentificativoDoc(); final IndexerValueDTO kafkaValue = new IndexerValueDTO(); kafkaValue.setWorkflowInstanceId(validationInfo.getValidationData().getWorkflowInstanceId()); - kafkaValue.setIdDoc(validationInfo.getJsonObj().getIdentificativoDoc()); + kafkaValue.setIdDoc(idDoc); kafkaValue.setEdsDPOperation(ProcessorOperationEnum.PUBLISH); - kafkaSRV.notifyChannel(validationInfo.getKafkaKey(), new Gson().toJson(kafkaValue), priorityType, validationInfo.getJsonObj().getTipoDocumentoLivAlto(), DestinationTypeEnum.INDEXER); + kafkaSRV.notifyChannel(idDoc, new Gson().toJson(kafkaValue), priorityType, validationInfo.getJsonObj().getTipoDocumentoLivAlto(), DestinationTypeEnum.INDEXER); kafkaSRV.sendPublicationStatus(traceInfoDTO.getTraceID(), validationInfo.getValidationData().getWorkflowInstanceId(), SUCCESS, null, validationInfo.getJsonObj(), validationInfo.getJwtPayloadToken()); - logger.info(Constants.App.LOG_TYPE_CONTROL,validationInfo.getValidationData().getWorkflowInstanceId(),String.format("Publication CDA completed for workflow instance id %s", validationInfo.getValidationData().getWorkflowInstanceId()), OperationLogEnum.PUB_CDA2, ResultLogEnum.OK, startDateOperation, getDocumentType(validationInfo.getDocument()), - validationInfo.getJwtPayloadToken(),null); + logger.info(Constants.App.LOG_TYPE_CONTROL,validationInfo.getValidationData().getWorkflowInstanceId(),String.format("Publication CDA completed for workflow instance id %s", validationInfo.getValidationData().getWorkflowInstanceId()), OperationLogEnum.PUB_CDA2, ResultLogEnum.OK, startDateOperation, getDocumentType(validationInfo.getDocument()), validationInfo.getJwtPayloadToken(),null); } @Override @@ -256,7 +257,7 @@ public ResponseEntity replace(final String idDoc, final Publi kafkaValue.setIdDoc(idDoc); kafkaValue.setEdsDPOperation(ProcessorOperationEnum.REPLACE); - kafkaSRV.notifyChannel(validationInfo.getKafkaKey(), new Gson().toJson(kafkaValue), PriorityTypeEnum.LOW, validationInfo.getJsonObj().getTipoDocumentoLivAlto(), DestinationTypeEnum.INDEXER); + kafkaSRV.notifyChannel(idDoc, new Gson().toJson(kafkaValue), PriorityTypeEnum.LOW, validationInfo.getJsonObj().getTipoDocumentoLivAlto(), DestinationTypeEnum.INDEXER); kafkaSRV.sendReplaceStatus(traceInfoDTO.getTraceID(), validationInfo.getValidationData().getWorkflowInstanceId(), SUCCESS, null, validationInfo.getJsonObj(), validationInfo.getJwtPayloadToken()); logger.info(Constants.App.LOG_TYPE_CONTROL,validationInfo.getValidationData().getWorkflowInstanceId(),String.format("Replace CDA completed for workflow instance id %s", validationInfo.getValidationData().getWorkflowInstanceId()), OperationLogEnum.REPLACE_CDA2, ResultLogEnum.OK, startDateOperation, @@ -422,10 +423,10 @@ private ValidationCreationInputDTO publicationAndReplaceValidation(final Multipa validateJWT(validation.getJwtPayloadToken(), cda); final org.jsoup.nodes.Document docT = Jsoup.parse(cda); - final String key = extractFieldCda(docT); +// final String key = extractFieldCda(docT); validation.setDocument(docT); - validation.setKafkaKey(key); +// validation.setKafkaKey(key); } catch (final ValidationException | NoRecordFoundException ve) { cdaSRV.consumeHash(validationInfo.getHash()); throw ve; @@ -741,7 +742,7 @@ public ResponseEntity validateAndReplace( kafkaValue.setIdDoc(idDoc); kafkaValue.setEdsDPOperation(ProcessorOperationEnum.REPLACE); - kafkaSRV.notifyChannel(validationResult.getKafkaKey(), new Gson().toJson(kafkaValue), PriorityTypeEnum.LOW, validationResult.getJsonObj().getTipoDocumentoLivAlto(), DestinationTypeEnum.INDEXER); + kafkaSRV.notifyChannel(idDoc, new Gson().toJson(kafkaValue), PriorityTypeEnum.LOW, validationResult.getJsonObj().getTipoDocumentoLivAlto(), DestinationTypeEnum.INDEXER); kafkaSRV.sendReplaceStatus(traceInfoDTO.getTraceID(), validationResult.getValidationData().getWorkflowInstanceId(), SUCCESS, null, validationResult.getJsonObj(), validationResult.getJwtPayloadToken()); logger.info(Constants.App.LOG_TYPE_CONTROL,validationResult.getValidationData().getWorkflowInstanceId(),String.format("Replace CDA completed for workflow instance id %s", validationResult.getValidationData().getWorkflowInstanceId()), OperationLogEnum.REPLACE_CDA2, ResultLogEnum.OK, startDateReplacenOperation, diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/dto/ValidationCreationInputDTO.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/dto/ValidationCreationInputDTO.java index d998a0e0..e5b975a4 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/dto/ValidationCreationInputDTO.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/dto/ValidationCreationInputDTO.java @@ -30,7 +30,7 @@ public class ValidationCreationInputDTO { private Document document; - private String kafkaKey; +// private String kafkaKey; private String documentSha;