Skip to content

Commit 67a73d7

Browse files
committed
feat(RedisNotificationSubscriber): 메시지 컨버팅 책임 추가
1 parent c38d9d2 commit 67a73d7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/com/somemore/notification/subscriber/RedisNotificationSubscriber.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.somemore.notification.subscriber;
22

3+
import com.somemore.notification.converter.MessageConverter;
4+
import com.somemore.notification.domain.Notification;
35
import com.somemore.notification.handler.NotificationHandler;
46
import lombok.RequiredArgsConstructor;
57
import org.springframework.data.redis.connection.Message;
@@ -11,11 +13,14 @@
1113
public class RedisNotificationSubscriber implements MessageListener {
1214

1315
private final NotificationHandler notificationHandler;
16+
private final MessageConverter messageConverter;
1417

1518
@Override
1619
public void onMessage(Message message, byte[] pattern) {
17-
String data = new String(message.getBody());
20+
Notification notification = messageConverter.ToNotification(
21+
new String(message.getBody())
22+
);
1823

19-
notificationHandler.handle(data);
24+
notificationHandler.handle(notification);
2025
}
2126
}

0 commit comments

Comments
 (0)