RED-9551: Fixed multiple analysis on upload #569
@ -23,7 +23,7 @@ dependencies {
|
||||
exclude(group = "com.iqser.red.service", module = "persistence-service-internal-api-v1")
|
||||
exclude(group = "com.iqser.red.service", module = "persistence-service-shared-api-v1")
|
||||
}
|
||||
api("com.knecon.fforesight:layoutparser-service-internal-api:0.90.0") {
|
||||
api("com.knecon.fforesight:layoutparser-service-internal-api:0.145.0") {
|
||||
exclude(group = "com.iqser.red.service", module = "persistence-service-internal-api-v1")
|
||||
exclude(group = "com.iqser.red.service", module = "persistence-service-shared-api-v1")
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.configuration;
|
||||
|
||||
import static com.knecon.fforesight.service.layoutparser.internal.api.queue.LayoutParsingQueueNames.LAYOUT_PARSING_DLQ;
|
||||
import static com.knecon.fforesight.service.layoutparser.internal.api.queue.LayoutParsingQueueNames.LAYOUT_PARSING_FINISHED_EVENT_QUEUE;
|
||||
import static com.knecon.fforesight.service.layoutparser.internal.api.queue.LayoutParsingQueueNames.LAYOUT_PARSING_REQUEST_QUEUE;
|
||||
|
||||
@ -74,6 +73,9 @@ public class MessagingConfiguration {
|
||||
public static final String X_ERROR_INFO_HEADER = "x-error-message";
|
||||
public static final String X_ERROR_INFO_TIMESTAMP_HEADER = "x-error-message-timestamp";
|
||||
|
||||
|
||||
public static final String LAYOUT_PARSING_DLQ = "layout_parsing_dead_letter_queue";
|
||||
|
||||
// --- Saas Migration, can be removed later ----
|
||||
|
||||
public static final String MIGRATION_QUEUE = "migrationQueue";
|
||||
|
||||
@ -29,7 +29,7 @@ public class LayoutParsingRequestFactory {
|
||||
|
||||
LayoutParsingType type = switch (applicationType) {
|
||||
case "DocuMine" -> LayoutParsingType.DOCUMINE;
|
||||
case "TAAS" -> LayoutParsingType.TAAS;
|
||||
case "TAAS" -> LayoutParsingType.CLARIFYND;
|
||||
default -> LayoutParsingType.REDACT_MANAGER;
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service.queue;
|
||||
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.configuration.MessagingConfiguration.LAYOUT_PARSING_DLQ;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
@ -64,14 +66,20 @@ public class LayoutParsingFinishedMessageReceiver {
|
||||
|
||||
fileStatusService.updateLayoutProcessedTime(layoutParsingRequestIdentifierService.parseFileId(response.identifier()));
|
||||
websocketService.sendAnalysisEvent(dossierId, fileId, AnalyseStatus.LAYOUT_UPDATE, fileStatusService.getStatus(fileId).getNumberOfAnalyses() + 1);
|
||||
imageSimilarityService.saveImages(templateId, dossierId, fileId, storageId);
|
||||
|
||||
try {
|
||||
imageSimilarityService.saveImages(templateId, dossierId, fileId, storageId);
|
||||
} catch (Exception e) {
|
||||
log.error("Error occured during save images: {} ", e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
log.info("Received message {} in {}", response, LayoutParsingQueueNames.LAYOUT_PARSING_FINISHED_EVENT_QUEUE);
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@RabbitListener(queues = LayoutParsingQueueNames.LAYOUT_PARSING_DLQ)
|
||||
@RabbitListener(queues = LAYOUT_PARSING_DLQ)
|
||||
public void handleDLQMessage(Message failedMessage) {
|
||||
|
||||
LayoutParsingRequest analyzeRequest = objectMapper.readValue(failedMessage.getBody(), LayoutParsingRequest.class);
|
||||
@ -93,7 +101,7 @@ public class LayoutParsingFinishedMessageReceiver {
|
||||
log.info("Failed to process layout parsing request, errorCause: {}, timestamp: {}", errorCause, timestamp);
|
||||
fileStatusProcessingUpdateService.analysisFailed(layoutParsingRequestIdentifierService.parseDossierId(analyzeRequest.identifier()),
|
||||
layoutParsingRequestIdentifierService.parseFileId(analyzeRequest.identifier()),
|
||||
new FileErrorInfo(errorCause, LayoutParsingQueueNames.LAYOUT_PARSING_DLQ, "layoutparser-service", timestamp));
|
||||
new FileErrorInfo(errorCause, LAYOUT_PARSING_DLQ, "layoutparser-service", timestamp));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user