From d05146c5d125dc60d33ddbd01f1ea4cb239fabbf Mon Sep 17 00:00:00 2001 From: csct3434 Date: Wed, 15 May 2024 11:59:16 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=A0=88=EA=B8=B0=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=8A=A4=EC=BC=80=EC=A4=84=EB=A7=81=20=EC=9E=91?= =?UTF-8?q?=EC=97=85=EC=9C=BC=EB=A1=9C=EB=B6=80=ED=84=B0=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=20=EC=A0=84=EC=86=A1=20=EA=B4=80=EC=8B=AC=EC=82=AC?= =?UTF-8?q?=EB=A5=BC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NotifyResultAspect를 적용하여 알림 전송 관심사를 절기 등록 스케줄링 작업으로부터 분리 --- .../RegisterNextYearSolarTermsService.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/today/seasoning/seasoning/solarterm/service/scheduled/RegisterNextYearSolarTermsService.java b/src/main/java/today/seasoning/seasoning/solarterm/service/scheduled/RegisterNextYearSolarTermsService.java index 3997d18..fe24e51 100644 --- a/src/main/java/today/seasoning/seasoning/solarterm/service/scheduled/RegisterNextYearSolarTermsService.java +++ b/src/main/java/today/seasoning/seasoning/solarterm/service/scheduled/RegisterNextYearSolarTermsService.java @@ -4,27 +4,20 @@ import lombok.RequiredArgsConstructor; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; -import today.seasoning.seasoning.common.aws.SnsService; +import today.seasoning.seasoning.common.aspect.NotifyResult; import today.seasoning.seasoning.solarterm.service.RegisterSolarTermsService; @Service @RequiredArgsConstructor public class RegisterNextYearSolarTermsService { - private final SnsService snsService; private final RegisterSolarTermsService registerSolarTermsService; @Scheduled(cron = "0 0 0 1 12 *") + @NotifyResult(name = "절기 등록 작업") public void doService() { int nextYear = LocalDate.now().getYear() + 1; - - try { - registerSolarTermsService.doService(nextYear); - - snsService.publish("[시즈닝] " + nextYear + "년 절기 등록 완료"); - } catch (Exception e) { - snsService.publish("[시즈닝] ERROR - " + nextYear + "년 절기 등록 실패"); - } + registerSolarTermsService.doService(nextYear); } }