From beb3152943bb3d644ca032e96fc8035c6d6c3dc0 Mon Sep 17 00:00:00 2001 From: "a.romanov" Date: Wed, 27 May 2020 15:37:30 +0300 Subject: [PATCH] BJ-917: Make PreparationFlowService async --- .../server/storage/ThreeDsServerStorageApplication.java | 4 ++++ .../threeds/server/storage/client/ThreeDsServerClient.java | 2 -- .../server/storage/service/PreparationFlowService.java | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/rbkmoney/threeds/server/storage/ThreeDsServerStorageApplication.java b/src/main/java/com/rbkmoney/threeds/server/storage/ThreeDsServerStorageApplication.java index 39f4a5d..ffe8413 100644 --- a/src/main/java/com/rbkmoney/threeds/server/storage/ThreeDsServerStorageApplication.java +++ b/src/main/java/com/rbkmoney/threeds/server/storage/ThreeDsServerStorageApplication.java @@ -3,7 +3,11 @@ package com.rbkmoney.threeds.server.storage; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.retry.annotation.EnableRetry; +import org.springframework.scheduling.annotation.EnableAsync; +@EnableRetry +@EnableAsync @ServletComponentScan @SpringBootApplication public class ThreeDsServerStorageApplication extends SpringApplication { diff --git a/src/main/java/com/rbkmoney/threeds/server/storage/client/ThreeDsServerClient.java b/src/main/java/com/rbkmoney/threeds/server/storage/client/ThreeDsServerClient.java index 725bb59..491dcad 100644 --- a/src/main/java/com/rbkmoney/threeds/server/storage/client/ThreeDsServerClient.java +++ b/src/main/java/com/rbkmoney/threeds/server/storage/client/ThreeDsServerClient.java @@ -6,7 +6,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.retry.annotation.Backoff; -import org.springframework.retry.annotation.EnableRetry; import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; import org.springframework.web.client.RestClientResponseException; @@ -14,7 +13,6 @@ import org.springframework.web.client.RestTemplate; @Slf4j @Service -@EnableRetry @RequiredArgsConstructor public class ThreeDsServerClient { diff --git a/src/main/java/com/rbkmoney/threeds/server/storage/service/PreparationFlowService.java b/src/main/java/com/rbkmoney/threeds/server/storage/service/PreparationFlowService.java index d509a79..7cec2bf 100644 --- a/src/main/java/com/rbkmoney/threeds/server/storage/service/PreparationFlowService.java +++ b/src/main/java/com/rbkmoney/threeds/server/storage/service/PreparationFlowService.java @@ -4,17 +4,17 @@ import com.rbkmoney.threeds.server.domain.root.rbkmoney.RBKMoneyPreparationReque import com.rbkmoney.threeds.server.domain.root.rbkmoney.RBKMoneyPreparationResponse; import com.rbkmoney.threeds.server.storage.client.ThreeDsServerClient; import lombok.RequiredArgsConstructor; -import org.springframework.retry.annotation.EnableRetry; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @Service -@EnableRetry @RequiredArgsConstructor public class PreparationFlowService { private final ThreeDsServerClient client; private final PreparationFlowDataUpdater dataUpdater; + @Async public void init(String providerId) { String serialNum = dataUpdater.getCurrentSerialNum(providerId);