Skip to content

Commit

Permalink
hotfix: added retry for onboarding ms client (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuraf authored Apr 4, 2024
1 parent 1bfb332 commit 4851ff0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
11 changes: 11 additions & 0 deletions app/src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,14 @@ logging:
it.pagopa.selfcare: ${B4F_ONBOARDING_LOG_LEVEL:DEBUG}
pattern:
additional-info: ",%X{X-Client-Ip:-}]"


resilience4j:
retry:
retry-aspect-order: 1
instances:
retryTimeout:
max-attempts: 3
wait-duration: 5s
retry-exceptions:
- feign.RetryableException
4 changes: 4 additions & 0 deletions connector/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.pagopa.selfcare.onboarding.connector;

import io.github.resilience4j.retry.annotation.Retry;
import it.pagopa.selfcare.commons.base.utils.InstitutionType;
import it.pagopa.selfcare.onboarding.connector.api.OnboardingMsConnector;
import it.pagopa.selfcare.onboarding.connector.model.onboarding.OnboardingData;
Expand Down Expand Up @@ -32,6 +33,7 @@ public OnboardingMsConnectorImpl(MsOnboardingApiClient msOnboardingApiClient, Ms
}

@Override
@Retry(name = "retryTimeout")
public void onboarding(OnboardingData onboardingData) {
if (onboardingData.getInstitutionType() == InstitutionType.PA) {
msOnboardingApiClient._v1OnboardingPaPost(onboardingMapper.toOnboardingPaRequest(onboardingData));
Expand All @@ -44,45 +46,53 @@ public void onboarding(OnboardingData onboardingData) {


@Override
@Retry(name = "retryTimeout")
public void onboardingCompany(OnboardingData onboardingData) {
msOnboardingApiClient._v1OnboardingPgCompletionPost(onboardingMapper.toOnboardingPgRequest(onboardingData));
}

@Override
@Retry(name = "retryTimeout")
public void onboardingTokenComplete(String onboardingId, MultipartFile contract) {
msOnboardingApiClient._v1OnboardingOnboardingIdCompletePut(onboardingId, contract);
}

@Override
@Retry(name = "retryTimeout")
public void onboardingPending(String onboardingId) {
msOnboardingApiClient._v1OnboardingOnboardingIdPendingGet(onboardingId);
}

@Override
@Retry(name = "retryTimeout")
public void approveOnboarding(String onboardingId) {
msOnboardingApiClient._v1OnboardingOnboardingIdApprovePut(onboardingId);
}

@Override
@Retry(name = "retryTimeout")
public void rejectOnboarding(String onboardingId, String reason) {
ReasonRequest reasonForReject = new ReasonRequest();
reasonForReject.setReasonForReject(reason);
msOnboardingApiClient._v1OnboardingOnboardingIdRejectPut(onboardingId, reasonForReject);
}

@Override
@Retry(name = "retryTimeout")
public OnboardingData getOnboarding(String onboardingId) {
OnboardingGet onboardingGet = msOnboardingApiClient._v1OnboardingOnboardingIdGet(onboardingId).getBody();
return onboardingMapper.toOnboardingData(onboardingGet);
}

@Override
@Retry(name = "retryTimeout")
public OnboardingData getOnboardingWithUserInfo(String onboardingId) {
OnboardingGet onboardingGet = msOnboardingApiClient._v1OnboardingOnboardingIdWithUserInfoGet(onboardingId).getBody();
return onboardingMapper.toOnboardingData(onboardingGet);
}

@Override
@Retry(name = "retryTimeout")
public Resource getContract(String onboardingId) {
return msOnboardingTokenApiClient._v1TokensOnboardingIdContractGet(onboardingId).getBody();
}
Expand Down
6 changes: 3 additions & 3 deletions helm/pnpg/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ingress:
hosts:
- host: "prod01.pnpg.internal.selfcare.pagopa.it"
paths:
- path: /onboarding/(.*)
- path: /imprese/onboarding/(.*)
pathType: ImplementationSpecific

autoscaling:
Expand All @@ -29,6 +29,6 @@ configEnvSpecific:
B4F_ONBOARDING_LOG_LEVEL: "INFO"
REST_CLIENT_LOGGER_LEVEL: "BASIC"
ONBOARDING_ALLOWED_INSTITUTIONS_PRODUCTS: "{'prod-pn-pg':{'*'}}"
MS_ONBOARDING_URL: "https://selc-p-pnpg-onboarding-ms-ca.salmonpond-60269923.westeurope.azurecontainerapps.io"
MS_ONBOARDING_URL: "https://selc-p-pnpg-onboarding-ms-ca.redbeach-5da5166f.westeurope.azurecontainerapps.io"
REST_CLIENT_READ_TIMEOUT: "60000"
REST_CLIENT_CONNECT_TIMEOUT: "60000"
REST_CLIENT_CONNECT_TIMEOUT: "5000"
2 changes: 1 addition & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ configEnvSpecific:
MS_ONBOARDING_URL: "https://selc-p-onboarding-ms-ca.salmonstone-7f910b8f.westeurope.azurecontainerapps.io"
ONBOARDING_ALLOWED_INSTITUTIONS_PRODUCTS: "{'prod-interop':{'*'},'prod-pn':{'*'},'prod-pagopa':{'*'},'prod-io':{'*'},'prod-io-premium':{'*'},'prod-io-sign':{'*'},'prod-sendino':{'*'},'prod-fd':{'*'},'prod-fd-garantito':{'*'}}"
REST_CLIENT_READ_TIMEOUT: "60000"
REST_CLIENT_CONNECT_TIMEOUT: "60000"
REST_CLIENT_CONNECT_TIMEOUT: "5000"

0 comments on commit 4851ff0

Please sign in to comment.