Tenants retry logic and queue renames

This commit is contained in:
Maverick Studer 2024-08-29 16:12:37 +02:00
parent 40d832fc3a
commit 6cf17ef4f3
5 changed files with 39 additions and 18 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
description = "redaction-service-api-v1"
val persistenceServiceVersion = "2.536.0"
val persistenceServiceVersion = "2.539.0"
dependencies {
implementation("org.springframework:spring-web:6.0.12")

View File

@ -1,16 +1,20 @@
package com.iqser.red.service.redaction.v1.model;
import java.util.Queue;
import org.springframework.context.annotation.Bean;
public class QueueNames {
public static final String REDACTION_REQUEST_QUEUE_PREFIX = "redaction_request_queue";
public static final String REDACTION_REQUEST_QUEUE_PREFIX = "redaction_request";
public static final String REDACTION_REQUEST_EXCHANGE = "redaction_request_exchange";
public static final String REDACTION_PRIORITY_REQUEST_QUEUE_PREFIX = "redaction_request_queue";
public static final String REDACTION_PRIORITY_REQUEST_QUEUE_PREFIX = "redaction_priority_request";
public static final String REDACTION_PRIORITY_REQUEST_EXCHANGE = "redaction_priority_request_exchange";
public static final String REDACTION_RESPONSE_EXCHANGE = "redaction_response_exchange";
public static final String REDACTION_DLQ = "redaction_dlq";
public static final String REDACTION_DLQ = "redaction_error";
public static final String MIGRATION_QUEUE = "migrationQueue";
public static final String MIGRATION_REQUEST_QUEUE = "migrationQueue";
public static final String MIGRATION_RESPONSE_QUEUE = "migrationResponseQueue";
public static final String MIGRATION_DLQ = "migrationDLQ";

View File

@ -16,7 +16,7 @@ val layoutParserVersion = "0.161.0"
val jacksonVersion = "2.15.2"
val droolsVersion = "9.44.0.Final"
val pdfBoxVersion = "3.0.0"
val persistenceServiceVersion = "2.536.0"
val persistenceServiceVersion = "2.539.0"
val llmServiceVersion = "1.11.0"
val springBootStarterVersion = "3.1.5"
val springCloudVersion = "4.0.4"
@ -46,8 +46,10 @@ dependencies {
implementation("com.iqser.red.commons:dictionary-merge-commons:1.5.0")
implementation("com.iqser.red.commons:storage-commons:2.45.0")
implementation("com.knecon.fforesight:tenant-commons:0.28.0")
implementation("com.knecon.fforesight:keycloak-commons:0.30.0")
implementation("com.knecon.fforesight:tenant-commons:0.29.0")
implementation("com.knecon.fforesight:keycloak-commons:0.30.0") {
exclude(group = "com.knecon.fforesight", module = "tenant-commons")
}
implementation("com.knecon.fforesight:tracing-commons:0.5.0")
implementation("com.knecon.fforesight:lifecycle-commons:0.7.0")

View File

@ -1,6 +1,6 @@
package com.iqser.red.service.redaction.v1.server.migration;
import static com.iqser.red.service.redaction.v1.model.QueueNames.MIGRATION_QUEUE;
import static com.iqser.red.service.redaction.v1.model.QueueNames.MIGRATION_REQUEST_QUEUE;
import static com.iqser.red.service.redaction.v1.model.QueueNames.MIGRATION_RESPONSE_QUEUE;
import org.springframework.amqp.core.Message;
@ -43,7 +43,7 @@ public class MigrationMessageReceiver {
@SneakyThrows
@RabbitHandler
@RabbitListener(queues = MIGRATION_QUEUE)
@RabbitListener(queues = MIGRATION_REQUEST_QUEUE)
public void receiveMigrationRequest(Message message) {
MigrationRequest migrationRequest = objectMapper.readValue(message.getBody(), MigrationRequest.class);

View File

@ -2,6 +2,7 @@ package com.iqser.red.service.redaction.v1.server.queue;
import static com.iqser.red.service.redaction.v1.model.QueueNames.*;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -18,6 +19,27 @@ public class MessagingConfiguration {
public static final String X_ERROR_INFO_TIMESTAMP_HEADER = "x-error-message-timestamp";
@Bean
public DirectExchange redactionRequestExchange() {
return new DirectExchange(REDACTION_REQUEST_EXCHANGE);
}
@Bean
public DirectExchange redactionPriorityRequestExchange() {
return new DirectExchange(REDACTION_PRIORITY_REQUEST_EXCHANGE);
}
@Bean
public Queue redactionDLQ() {
return QueueBuilder.durable(REDACTION_DLQ).build();
}
@Bean
@ConditionalOnProperty(prefix = "redaction-service", name = "priorityMode", havingValue = "false")
public MessageReceiver messageReceiver(RedactionMessageReceiver redactionMessageReceiver) {
@ -37,7 +59,7 @@ public class MessagingConfiguration {
@Bean
public Queue migrationQueue() {
return QueueBuilder.durable(MIGRATION_QUEUE).withArgument("x-dead-letter-exchange", "").withArgument("x-dead-letter-routing-key", MIGRATION_DLQ).maxPriority(2).build();
return QueueBuilder.durable(MIGRATION_REQUEST_QUEUE).withArgument("x-dead-letter-exchange", "").withArgument("x-dead-letter-routing-key", MIGRATION_DLQ).maxPriority(2).build();
}
@ -47,11 +69,4 @@ public class MessagingConfiguration {
return QueueBuilder.durable(MIGRATION_DLQ).build();
}
@Bean
public Queue redactionDLQ() {
return QueueBuilder.durable(REDACTION_DLQ).build();
}
}