diff --git a/.dev/docker-compose.yaml b/.dev/docker-compose.yaml old mode 100644 new mode 100755 diff --git a/persistence-service-v1/persistence-service-processor-v1/pom.xml b/persistence-service-v1/persistence-service-processor-v1/pom.xml index 8ff5c0fa3..ef295ab42 100644 --- a/persistence-service-v1/persistence-service-processor-v1/pom.xml +++ b/persistence-service-v1/persistence-service-processor-v1/pom.xml @@ -18,8 +18,8 @@ 0.4.0 0.5.0 0.18.0 - 0.8.0 - 0.13.0 + 0.9.0 + 0.15.0 diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/configuration/UserMessagingConfiguration.java b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/configuration/UserMessagingConfiguration.java index a92085370..e3f399e5f 100644 --- a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/configuration/UserMessagingConfiguration.java +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/configuration/UserMessagingConfiguration.java @@ -141,7 +141,7 @@ public class UserMessagingConfiguration { @Bean(name = "userExchange") - TopicExchange tenantExchange(@Value("${fforesight.user-exchange.name}") String userExchange) { + TopicExchange userExchange(@Value("${fforesight.user-exchange.name}") String userExchange) { return new TopicExchange(userExchange); } diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/migration/SaasMigrationService.java b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/migration/SaasMigrationService.java index 0b4335c44..302d5ecf3 100644 --- a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/migration/SaasMigrationService.java +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/migration/SaasMigrationService.java @@ -16,6 +16,8 @@ import com.iqser.red.service.redaction.v1.model.MigrationRequest; import com.iqser.red.storage.commons.exception.StorageException; import com.iqser.red.storage.commons.exception.StorageObjectDoesNotExist; import com.iqser.red.storage.commons.service.StorageService; +import com.knecon.fforesight.databasetenantcommons.providers.TenantSyncService; +import com.knecon.fforesight.databasetenantcommons.providers.events.TenantSyncEvent; import com.knecon.fforesight.tenantcommons.TenantContext; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -30,7 +32,7 @@ import static com.knecon.fforesight.service.layoutparser.internal.api.queue.Layo @Slf4j @Service @RequiredArgsConstructor -public class SaasMigrationService { +public class SaasMigrationService implements TenantSyncService { private final AutomaticAnalysisJob automaticAnalysisJob; private final FileStatusPersistenceService fileStatusPersistenceService; @@ -45,6 +47,13 @@ public class SaasMigrationService { private final SaasAnnotationIdMigrationService saasAnnotationIdMigrationService; + + @Override + public void syncTenant(TenantSyncEvent tenantSyncEvent) { + + startMigrationForTenant(tenantSyncEvent.getTenantId()); + } + // Persistence-Service needs to be scaled to 1. public void startMigrationForTenant(String tenantId) { @@ -90,8 +99,8 @@ public class SaasMigrationService { public void handleError(String dossierId, String fileId, String errorCause, String retryQueue) { var migrationEntry = saasMigrationStatusPersistenceService.findById(fileId); - int numErrors = migrationEntry.getProcessingErrorCounter(); - if (numErrors <= settings.getMaxErrorRetries()) { + Integer numErrors = migrationEntry.getProcessingErrorCounter(); + if (numErrors !=null && numErrors <= settings.getMaxErrorRetries()) { saasMigrationStatusPersistenceService.updateErrorCounter(fileId, numErrors + 1, errorCause); rabbitTemplate.convertAndSend(retryQueue, MigrationRequest.builder() .dossierId(dossierId) @@ -138,4 +147,6 @@ public class SaasMigrationService { } + + } diff --git a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml index c49a6fac7..d4007e382 100644 --- a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml +++ b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml @@ -22,6 +22,7 @@ multitenancy: prepStmtCacheSqlLimit: 2048 liquibase: changeLog: classpath:db/changelog/db.changelog-tenant.yaml + clear-checksums: true monitoring:enabled: true cors.enabled: true @@ -35,3 +36,17 @@ persistence-service: fforesight: springdoc: auth-server-url: 'http://localhost:8080/auth' + jobs: + enabled: true + datasource: + url: jdbc:postgresql://${PSQL_HOST:localhost}:${PSQL_PORT:25432}/${PSQL_DATABASE:tenantmanager}?ApplicationName=${spring.application.name:}-scheduler&cachePrepStmts=true&useServerPrepStmts=true&rewriteBatchedStatements=true + driverClassName: org.postgresql.Driver + username: ${PSQL_USERNAME:tenantmanager} + password: ${PSQL_PASSWORD:r3dact3d} + platform: org.hibernate.dialect.PostgreSQL95Dialect + hikari: + maximumPoolSize: 2 + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 1000 + prepStmtCacheSqlLimit: 2048 diff --git a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml index 42d540984..22c0b5cab 100644 --- a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml +++ b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml @@ -10,7 +10,7 @@ tenant-user-management-service.url: "http://tenant-user-management-service:8080/ application: type: "RedactManager" rss.component-log.enabled: false - + server: port: 8080 @@ -89,6 +89,7 @@ multitenancy: prepStmtCacheSqlLimit: 2048 liquibase: changeLog: classpath:db/changelog/db.changelog-tenant.yaml + clear-checksums: true bucket4j: @@ -123,6 +124,7 @@ fforesight: user-exchange: name: 'users-exchange' jobs: + enabled: true tenants: remote: true diff --git a/persistence-service-v1/pom.xml b/persistence-service-v1/pom.xml index 0bd891dcb..8cae651b1 100755 --- a/persistence-service-v1/pom.xml +++ b/persistence-service-v1/pom.xml @@ -6,7 +6,7 @@ com.iqser.red platform-dependency - 2.2.0 + 2.19.0 @@ -31,6 +31,8 @@ + true + true 4.177.0 2.71.0 4.38.0