From da8417434b8bbcf3d47acf36e2c713af879ef615 Mon Sep 17 00:00:00 2001 From: nowgnas Date: Mon, 18 Dec 2023 11:30:47 +0900 Subject: [PATCH 1/3] :recycle: Refactor notification event data --- build.gradle | 2 +- .../infrastructure/message/NotificationSQSListener.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 4f1e265..d34817d 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ dependencies { implementation 'org.springframework.cloud:spring-cloud-aws-messaging:2.2.4.RELEASE' implementation 'org.springframework.kafka:spring-kafka' implementation 'software.amazon.awssdk:sns:2.21.37' - implementation 'io.github.lotteon-maven:blooming-blooms-utils:202312140709' + implementation 'io.github.lotteon-maven:blooming-blooms-utils:202312180146' testImplementation 'org.mockito:mockito-core:4.8.0' diff --git a/src/main/java/kr/bb/notification/domain/notification/infrastructure/message/NotificationSQSListener.java b/src/main/java/kr/bb/notification/domain/notification/infrastructure/message/NotificationSQSListener.java index 8203aea..246787b 100644 --- a/src/main/java/kr/bb/notification/domain/notification/infrastructure/message/NotificationSQSListener.java +++ b/src/main/java/kr/bb/notification/domain/notification/infrastructure/message/NotificationSQSListener.java @@ -273,7 +273,7 @@ public void consumeOrderCancelNotificationQueue( ack.acknowledge(); } - @SqsListener( + @SqsListener( value = "${cloud.aws.sqs.inquery-response-notification-queue.name}", deletionPolicy = SqsMessageDeletionPolicy.NEVER) public void consumeInqueryResponseNotificationQueue( @@ -284,7 +284,8 @@ public void consumeInqueryResponseNotificationQueue( message, objectMapper .getTypeFactory() - .constructParametricType(NotificationData.class, InqueryResponseNotification.class)); + .constructParametricType( + NotificationData.class, InqueryResponseNotification.class)); NotificationData notification = NotificationData.notifyData( orderCancel.getWhoToNotify(), From a3fbb2e21a3a812ba2b7cef23397d377441f8d43 Mon Sep 17 00:00:00 2001 From: nowgnas Date: Mon, 18 Dec 2023 12:33:25 +0900 Subject: [PATCH 2/3] :recycle: Refactor publish message --- build.gradle | 2 +- .../entity/NotificationCommand.java | 10 ++++++---- .../infrastructure/sms/SendSMS.java | 19 +++++++++++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index d34817d..6e201d0 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ dependencies { implementation 'org.springframework.cloud:spring-cloud-aws-messaging:2.2.4.RELEASE' implementation 'org.springframework.kafka:spring-kafka' implementation 'software.amazon.awssdk:sns:2.21.37' - implementation 'io.github.lotteon-maven:blooming-blooms-utils:202312180146' + implementation 'io.github.lotteon-maven:blooming-blooms-utils:202312180304' testImplementation 'org.mockito:mockito-core:4.8.0' diff --git a/src/main/java/kr/bb/notification/domain/notification/entity/NotificationCommand.java b/src/main/java/kr/bb/notification/domain/notification/entity/NotificationCommand.java index 16f17e0..3784b6a 100644 --- a/src/main/java/kr/bb/notification/domain/notification/entity/NotificationCommand.java +++ b/src/main/java/kr/bb/notification/domain/notification/entity/NotificationCommand.java @@ -78,6 +78,7 @@ public static UnreadNotificationCount getData(Long unreadNotificationCount) { @AllArgsConstructor public static class NotificationInformation { private Long id; + private String type; private String content; private String redirectUrl; private String phoneNumber; @@ -91,7 +92,8 @@ public static List getResaleNotificationData( item -> NotificationInformation.builder() .id(item.getUserId()) - .content( + .content(restoreNotification.getPublishInformation().getContent()) + .type( restoreNotification .getPublishInformation() .getNotificationKind() @@ -112,7 +114,7 @@ public static NotificationInformation getSSEData( .role(publishNotificationInformation.getRole()) .notificationKind(publishNotificationInformation.getNotificationKind()) .redirectUrl(publishNotificationInformation.getNotificationUrl()) - .content(publishNotificationInformation.getNotificationKind().getMessage()) + .type(publishNotificationInformation.getNotificationKind().getMessage()) .build(); } @@ -121,7 +123,7 @@ public static NotificationInformation getDeliveryNotificationData( return NotificationInformation.builder() .role(notificationData.getPublishInformation().getRole()) .phoneNumber(notificationData.getWhoToNotify().getPhoneNumber()) - .content(notificationData.getWhoToNotify().getDeliveryStatus().getMessage()) + .type(notificationData.getWhoToNotify().getDeliveryStatus().getMessage()) .redirectUrl(notificationData.getPublishInformation().getNotificationUrl()) .id(notificationData.getWhoToNotify().getUserId()) .notificationKind(notificationData.getPublishInformation().getNotificationKind()) @@ -136,7 +138,7 @@ public static NotificationInformation getSMSData( .id(notification.getWhoToNotify().getUserId()) .phoneNumber(notification.getWhoToNotify().getPhoneNumber()) .redirectUrl(notification.getPublishInformation().getNotificationUrl()) - .content(notification.getPublishInformation().getNotificationKind().getMessage()) + .type(notification.getPublishInformation().getNotificationKind().getMessage()) .build(); } } diff --git a/src/main/java/kr/bb/notification/domain/notification/infrastructure/sms/SendSMS.java b/src/main/java/kr/bb/notification/domain/notification/infrastructure/sms/SendSMS.java index 92fcaeb..fb8e64c 100644 --- a/src/main/java/kr/bb/notification/domain/notification/infrastructure/sms/SendSMS.java +++ b/src/main/java/kr/bb/notification/domain/notification/infrastructure/sms/SendSMS.java @@ -21,10 +21,21 @@ public class SendSMS implements InfrastructureActionHandler Date: Mon, 18 Dec 2023 12:45:53 +0900 Subject: [PATCH 3/3] :recycle: Refactor notification process --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e201d0..e31657c 100644 --- a/build.gradle +++ b/build.gradle @@ -80,7 +80,7 @@ jacocoTestCoverageVerification { value = 'COVEREDRATIO' minimum = 0.80 } - excludes = ["*.mapper*", "**.emitter.**"] + excludes = ["*.mapper*", "**.emitter.**", "**.infrastructure.**"] } } }