RED-5277: Fixed Message Deserialization in Ner/Image service resonse

This commit is contained in:
deiflaender 2023-02-16 14:50:03 +01:00
parent 9e54a8a132
commit 7212012cd6
2 changed files with 2 additions and 7 deletions

View File

@ -1,6 +1,5 @@
package com.iqser.red.service.peristence.v1.server.service;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.HashMap;
@ -13,7 +12,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iqser.red.service.peristence.v1.server.configuration.MessagingConfiguration;
import com.iqser.red.service.peristence.v1.server.settings.FileManagementServiceSettings;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileType;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@ -33,16 +31,13 @@ public class ImageMessageReceiver {
@SneakyThrows
@RabbitListener(queues = MessagingConfiguration.IMAGE_SERVICE_RESPONSE_QUEUE)
public void receive(byte[] in) {
public void receive(String in) {
JsonNode imageResponse = objectMapper.readTree(in);
String dossierId = imageResponse.path("dossierId").asText();
String fileId = imageResponse.path("fileId").asText();
if (settings.isStoreImageFile()) {
fileManagementStorageService.storeObject(dossierId, fileId, FileType.IMAGE_INFO, new ByteArrayInputStream(in));
}
fileStatusService.setStatusAnalyse(dossierId, fileId, false);
log.info("Received message from {} for dossierId {} and fileId {}", MessagingConfiguration.IMAGE_SERVICE_RESPONSE_QUEUE, dossierId, fileId);

View File

@ -27,7 +27,7 @@ public class NerMessageReceiver {
@SneakyThrows
@RabbitListener(queues = MessagingConfiguration.NER_SERVICE_RESPONSE_QUEUE)
public void receive(byte[] in) {
public void receive(String in) {
HashMap<String, Object> entityResponse = objectMapper.readValue(in, new TypeReference<>() {
});