diff --git a/.grype.yaml b/.grype.yaml
index 57006e14..70db95e6 100644
--- a/.grype.yaml
+++ b/.grype.yaml
@@ -1,6 +1,6 @@
ignore:
# false positive match on reactor-netty packages due to a bug on grype: https://github.com/anchore/grype/issues/431
- # Actually we are using netty 4.1.94
+ # Actually we are using netty 4.1.100
- vulnerability: CVE-2014-3488 # solved in netty 3.9.2
- vulnerability: CVE-2015-2156 # solved in netty 4.1.42
- vulnerability: CVE-2019-16869 # solved in netty 4.1.42
@@ -15,3 +15,4 @@ ignore:
- vulnerability: CVE-2022-24823 # solved in netty 4.1.77
- vulnerability: CVE-2022-41881 # solved in netty 4.1.86
- vulnerability: CVE-2023-34462 # solved in netty 4.1.94
+ - vulnerability: CVE-2023-44487 # solved in netty 4.1.100
diff --git a/Dockerfile b/Dockerfile
index ac1d0682..ff038b9a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
#
# Build
#
-FROM maven:3.9.4-amazoncorretto-17-al2023@sha256:c7719f952f62e301c6c24b86ef9a2ea1cd0a314a862ed12e51f0ffbc3fbb96b5 AS buildtime
+FROM maven:3.9.5-amazoncorretto-17-al2023@sha256:b7f94a5f1b6582a045692e31c2c97ef6f0ed867961669a0adbc2d5f0bbf8bc85 AS buildtime
WORKDIR /build
COPY . .
@@ -11,7 +11,7 @@ RUN mvn clean package -DskipTests
#
# Docker RUNTIME
#
-FROM amazoncorretto:17.0.8-alpine3.18@sha256:34650d7c653af234dad21cd2d89d2f0dbdb1bad54041014932e51b3492e0dec5 AS runtime
+FROM amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 AS runtime
RUN apk add shadow
RUN useradd --uid 10000 runner
@@ -21,7 +21,7 @@ WORKDIR /app
COPY --from=buildtime /build/target/*.jar /app/app.jar
# The agent is enabled at runtime via JAVA_TOOL_OPTIONS.
-ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.16/applicationinsights-agent-3.4.16.jar /app/applicationinsights-agent.jar
+ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.17/applicationinsights-agent-3.4.17.jar /app/applicationinsights-agent.jar
RUN chown -R runner:runner /app
diff --git a/pom.xml b/pom.xml
index 3af88fa5..ba6dd1fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,17 +4,18 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.3
-
-
+ 3.1.5
+
it.gov.pagopa
idpay-admissibility-assessor
- 1.2.1
idpay-admissibility-assessor
+ 1.2.1
+
17
+
@@ -67,41 +68,41 @@
com.azure.spring
spring-cloud-azure-stream-binder-servicebus
- 5.4.0
+ 5.5.0
jakarta.activation
jakarta.activation-api
- 2.1.0
+ 2.1.2
jakarta.xml.soap
jakarta.xml.soap-api
- 3.0.0
+ 3.0.1
com.sun.xml.ws
jaxws-rt
- 4.0.1
+ 4.0.2
jakarta.xml.ws
jakarta.xml.ws-api
- 4.0.0
+ 4.0.1
jakarta.xml.bind
jakarta.xml.bind-api
- 4.0.0
+ 4.0.1
org.projectlombok
lombok
- 1.18.28
+ 1.18.30
org.apache.commons
@@ -116,7 +117,7 @@
com.google.guava
guava
- 32.1.2-jre
+ 32.1.3-jre
org.openapitools
@@ -131,7 +132,7 @@
org.springdoc
springdoc-openapi-starter-webflux-ui
- 2.1.0
+ 2.2.0
org.apache.commons
@@ -143,14 +144,14 @@
org.yaml
snakeyaml
-
- 2.0
+
+ 2.2
org.xerial.snappy
snappy-java
-
- 1.1.10.3
+
+ 1.1.10.5
test
@@ -163,13 +164,11 @@
org.junit.jupiter
junit-jupiter-engine
- 5.8.2
test
org.junit.platform
junit-platform-launcher
- 1.8.2
test
@@ -180,7 +179,7 @@
org.springframework.cloud
spring-cloud-contract-wiremock
- 4.0.2
+ 4.0.4
test
@@ -197,7 +196,7 @@
de.flapdoodle.embed
de.flapdoodle.embed.mongo.spring30x
- 4.7.0
+ 4.9.3
test
@@ -229,6 +228,15 @@
pom
import
+
+
+ io.netty
+ netty-bom
+
+ 4.1.100.Final
+ pom
+ import
+
diff --git a/src/main/java/it/gov/pagopa/admissibility/service/commands/CommandMediatorServiceImpl.java b/src/main/java/it/gov/pagopa/admissibility/service/commands/CommandMediatorServiceImpl.java
index adb18972..acb31dfb 100644
--- a/src/main/java/it/gov/pagopa/admissibility/service/commands/CommandMediatorServiceImpl.java
+++ b/src/main/java/it/gov/pagopa/admissibility/service/commands/CommandMediatorServiceImpl.java
@@ -5,6 +5,7 @@
import it.gov.pagopa.admissibility.dto.commands.QueueCommandOperationDTO;
import it.gov.pagopa.admissibility.service.AdmissibilityErrorNotifierService;
import it.gov.pagopa.admissibility.service.commands.operations.DeleteInitiativeService;
+import it.gov.pagopa.admissibility.service.onboarding.OnboardingContextHolderService;
import it.gov.pagopa.admissibility.utils.CommandConstants;
import it.gov.pagopa.common.reactive.kafka.consumer.BaseKafkaConsumer;
import lombok.extern.slf4j.Slf4j;
@@ -23,20 +24,29 @@
public class CommandMediatorServiceImpl extends BaseKafkaConsumer implements CommandMediatorService{
private final Duration commitDelay;
+ private final Duration beneficiaryRulesBuildDelayMinusCommit;
private final DeleteInitiativeService deleteInitiativeService;
+ private final OnboardingContextHolderService onboardingContextHolderService;
private final AdmissibilityErrorNotifierService admissibilityErrorNotifierService;
private final ObjectReader objectReader;
public CommandMediatorServiceImpl(@Value("${spring.application.name}") String applicationName,
@Value("${spring.cloud.stream.kafka.bindings.consumerCommands-in-0.consumer.ackTime}") long commitMillis,
+ @Value("${app.beneficiary-rule.build-delay-duration}") String beneficiaryRulesBuildDelay,
+
DeleteInitiativeService deleteInitiativeService,
- AdmissibilityErrorNotifierService admissibilityErrorNotifierService,
+ OnboardingContextHolderService onboardingContextHolderService, AdmissibilityErrorNotifierService admissibilityErrorNotifierService,
ObjectMapper objectMapper) {
super(applicationName);
this.commitDelay = Duration.ofMillis(commitMillis);
this.deleteInitiativeService = deleteInitiativeService;
+ this.onboardingContextHolderService = onboardingContextHolderService;
this.admissibilityErrorNotifierService = admissibilityErrorNotifierService;
this.objectReader = objectMapper.readerFor(QueueCommandOperationDTO.class);
+
+ Duration beneficiaryRulesBuildDelayDuration = Duration.parse(beneficiaryRulesBuildDelay).minusMillis(commitMillis);
+ Duration defaultDurationDelay = Duration.ofMillis(2L);
+ this.beneficiaryRulesBuildDelayMinusCommit = defaultDurationDelay.compareTo(beneficiaryRulesBuildDelayDuration) >= 0 ? defaultDurationDelay : beneficiaryRulesBuildDelayDuration;
}
@Override
@@ -47,6 +57,8 @@ protected Duration getCommitDelay() {
@Override
protected void subscribeAfterCommits(Flux> afterCommits2subscribe) {
afterCommits2subscribe
+ .buffer(beneficiaryRulesBuildDelayMinusCommit)
+ .then(onboardingContextHolderService.refreshKieContainerCacheMiss())
.subscribe(r -> log.info("[ADMISSIBILITY_COMMANDS] Processed offsets committed successfully"));
}
diff --git a/src/main/java/it/gov/pagopa/admissibility/service/commands/operations/DeleteInitiativeServiceImpl.java b/src/main/java/it/gov/pagopa/admissibility/service/commands/operations/DeleteInitiativeServiceImpl.java
index 6afd9f55..b589d41f 100644
--- a/src/main/java/it/gov/pagopa/admissibility/service/commands/operations/DeleteInitiativeServiceImpl.java
+++ b/src/main/java/it/gov/pagopa/admissibility/service/commands/operations/DeleteInitiativeServiceImpl.java
@@ -3,8 +3,8 @@
import it.gov.pagopa.admissibility.connector.repository.DroolsRuleRepository;
import it.gov.pagopa.admissibility.connector.repository.InitiativeCountersRepository;
import it.gov.pagopa.admissibility.connector.repository.OnboardingFamiliesRepository;
-import it.gov.pagopa.admissibility.service.onboarding.OnboardingContextHolderService;
import it.gov.pagopa.admissibility.utils.AuditUtilities;
+import it.gov.pagopa.common.reactive.utils.PerformanceLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -20,7 +20,6 @@ public class DeleteInitiativeServiceImpl implements DeleteInitiativeService{
private final InitiativeCountersRepository initiativeCountersRepository;
private final OnboardingFamiliesRepository onboardingFamiliesRepository;
private final AuditUtilities auditUtilities;
- private final OnboardingContextHolderService onboardingContextHolderService;
private final int pageSize;
private final long delay;
@@ -28,14 +27,12 @@ public DeleteInitiativeServiceImpl(DroolsRuleRepository droolsRuleRepository,
InitiativeCountersRepository initiativeCountersRepository,
OnboardingFamiliesRepository onboardingFamiliesRepository,
AuditUtilities auditUtilities,
- OnboardingContextHolderService onboardingContextHolderService,
@Value("${app.delete.paginationSize}") int pageSize,
@Value("${app.delete.delayTime}") long delay) {
this.droolsRuleRepository = droolsRuleRepository;
this.initiativeCountersRepository = initiativeCountersRepository;
this.onboardingFamiliesRepository = onboardingFamiliesRepository;
this.auditUtilities = auditUtilities;
- this.onboardingContextHolderService = onboardingContextHolderService;
this.pageSize = pageSize;
this.delay = delay;
}
@@ -43,19 +40,22 @@ public DeleteInitiativeServiceImpl(DroolsRuleRepository droolsRuleRepository,
@Override
public Mono execute(String initiativeId) {
log.info("[DELETE_INITIATIVE] Starting handle delete initiative {}", initiativeId);
- return deleteDroolsRule(initiativeId)
- .then(deleteInitiativeCounters(initiativeId))
- .then(deleteOnboardingFamilies(initiativeId))
+ return execAndLogTiming("DELETE_DROOLS_RULE", initiativeId, deleteDroolsRule(initiativeId))
+ .then(execAndLogTiming("DELETE_INITIATIVE_COUNTERS", initiativeId, deleteInitiativeCounters(initiativeId)))
+ .then(execAndLogTiming("DELETE_ONBOARDING_FAMILIES", initiativeId, deleteOnboardingFamilies(initiativeId)))
.then(Mono.just(initiativeId));
}
+ private Mono> execAndLogTiming(String deleteFlowName, String initiativeId, Mono> deleteMono) {
+ return PerformanceLogger.logTimingFinally(deleteFlowName, deleteMono, initiativeId);
+ }
+
private Mono deleteDroolsRule(String initiativeId) {
return droolsRuleRepository.deleteById(initiativeId)
.doOnSuccess(d -> {
log.info("[DELETE_INITIATIVE] Deleted initiative {} from collection: beneficiary_rule", initiativeId);
auditUtilities.logDeletedDroolsRule(initiativeId);
})
- .then(onboardingContextHolderService.refreshKieContainerCacheMiss())
.then();
}
diff --git a/src/main/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeAutomaticRetryAspect.java b/src/main/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeAutomaticRetryAspect.java
index 559cbcee..0f5d2be5 100644
--- a/src/main/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeAutomaticRetryAspect.java
+++ b/src/main/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeAutomaticRetryAspect.java
@@ -1,6 +1,7 @@
package it.gov.pagopa.common.reactive.mongo.retry;
import it.gov.pagopa.common.reactive.web.ReactiveRequestContextHolder;
+import lombok.Generated;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
@@ -47,6 +48,12 @@ public MongoRequestRateTooLargeAutomaticRetryAspect(
this.maxMillisElapsedBatch = maxMillisElapsedBatch;
}
+ @Generated
+ @Pointcut("execution(* org.springframework.data.mongodb.repository.*MongoRepository+.*(..))")
+ public void inSpringRepositoryClass() {
+ }
+
+ @Generated
@Pointcut("within(*..*Repository*)")
public void inRepositoryClass() {
}
@@ -59,35 +66,35 @@ public void returnMono() {
public void returnFlux() {
}
- @Around("inRepositoryClass() && returnMono()")
+ @Around("(inRepositoryClass() or inSpringRepositoryClass()) && returnMono()")
public Object decorateMonoRepositoryMethods(ProceedingJoinPoint pjp) throws Throwable {
Mono> out = (Mono>) pjp.proceed();
-
- return Mono.deferContextual(ctx -> decorateMethod(out, ctx));
+ String flowName = pjp.getSignature().toShortString();
+ return Mono.deferContextual(ctx -> decorateMethod(flowName, out, ctx));
}
- @Around("inRepositoryClass() && returnFlux()")
+ @Around("(inRepositoryClass() or inSpringRepositoryClass()) && returnFlux()")
public Object decorateFluxRepositoryMethods(ProceedingJoinPoint pjp) throws Throwable {
@SuppressWarnings("unchecked") // only with Flux the compiler return error when using wildcard, so here we are using Object
Flux