[FEAT] 비동기 알림 재처리 및 멱등성 보장 로직 구현#77
Merged
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughThis PR introduces a comprehensive chat system overhaul by removing MongoDB, implementing WebSocket-based group chat with rooms and members, establishing event-driven architecture for room/roommate flows, adding rate limiting infrastructure, and refactoring the notification delivery pipeline from outbox-based to immediate dispatch with Spring Retry. Changes
Sequence Diagram(s)sequenceDiagram
actor User as User (Host)
participant Frontend
participant RoomAPI as Room API
participant RoomSvc as Room Service
participant EventBus as Event Publisher
participant ChatRoomUC as CreateChatRoomUseCase
participant ChatRoomSvc as ChatRoomService
participant ChatMemberSvc as ChatRoomMemberService
User->>Frontend: Confirm room assignment
Frontend->>RoomAPI: POST /api/rooms/{id}/confirm
RoomAPI->>RoomSvc: execute(roomNo)
RoomSvc->>RoomSvc: Update status to COMPLETED
RoomSvc->>RoomSvc: Collect all roommate userNos
RoomSvc->>EventBus: publishEvent(RoomConfirmedEvent)
EventBus->>ChatRoomUC: handle(RoomConfirmedEvent)
activate ChatRoomUC
ChatRoomUC->>ChatRoomSvc: findByRoomNo(roomNo)
alt Chat room not exists
ChatRoomUC->>ChatRoomSvc: create(roomNo)
end
ChatRoomUC->>ChatMemberSvc: join(chatRoom, each userNo)
ChatRoomUC->>ChatRoomSvc: (save updates)
deactivate ChatRoomUC
RoomSvc-->>RoomAPI: success
RoomAPI-->>Frontend: 200 OK
sequenceDiagram
actor WebSocketClient as Client (STOMP)
participant WebSocket as STOMP Endpoint
participant JwtInterceptor as JWT Interceptor
participant AuthInterceptor as Chat Auth Interceptor
participant ChatMsgCtrl as ChatMessageController
participant SendGroupMsgUC as SendGroupChatMessageUseCase
participant ChatMsgSvc as ChatMessageService
participant SimpMessaging as STOMP Broker
participant NotificationPub as NotificationPublisher
WebSocketClient->>WebSocket: CONNECT /ws
WebSocket->>JwtInterceptor: validateToken from cookie
JwtInterceptor->>WebSocket: Extract userNo, allow handshake
WebSocket-->>WebSocketClient: CONNECTED (userNo in session)
WebSocketClient->>WebSocket: SEND /app/chat-room/{roomNo}/send
WebSocket->>AuthInterceptor: preSend (STOMP frame)
AuthInterceptor->>AuthInterceptor: Extract userNo from session
AuthInterceptor-->>WebSocket: Validate userNo exists
WebSocket->>ChatMsgCtrl: send(roomNo, request, headerAccessor)
ChatMsgCtrl->>SendGroupMsgUC: send(roomNo, senderNo, content)
activate SendGroupMsgUC
SendGroupMsgUC->>ChatMsgSvc: save(chatRoom, senderNo, content, TEXT, unreadCount)
ChatMsgSvc-->>SendGroupMsgUC: ChatMessage
SendGroupMsgUC->>SimpMessaging: convertAndSend(/topic/chat-room/{roomNo}, ChatMessageResponse)
SendGroupMsgUC->>NotificationPub: publish(recipientNo) for each member except sender
deactivate SendGroupMsgUC
SimpMessaging->>WebSocketClient: Broadcast to all room subscribers
NotificationPub-->>NotificationPub: Send FCM notification asynchronously
sequenceDiagram
participant FcmService as FCM Service
participant NotificationDeliveryService as NotificationDeliveryService
participant NotificationDeliveryOrchestrator as DeliveryOrchestrator
participant DeviceService as DeviceService
participant FcmNotificationDelivery as FcmNotificationDelivery
participant SystemAlertPublisher as SystemAlertPublisher
FcmService->>NotificationDeliveryService: deliver(Notification)
activate NotificationDeliveryService
NotificationDeliveryService->>DeviceService: findByUserNo(recipientNo)
DeviceService-->>NotificationDeliveryService: Device list
NotificationDeliveryService->>NotificationDeliveryOrchestrator: deliver(payload, deviceList)
NotificationDeliveryOrchestrator->>FcmNotificationDelivery: sendMulticast(...)
FcmNotificationDelivery-->>NotificationDeliveryOrchestrator: DeliveryResult {retryableTokens, invalidTokens}
alt Has Invalid Tokens
NotificationDeliveryOrchestrator->>DeviceService: clearInvalidFcmTokens(invalidTokens)
end
alt Has Retryable Tokens
NotificationDeliveryOrchestrator-->>NotificationDeliveryService: throw RestApiException (trigger retry)
NotificationDeliveryService->>NotificationDeliveryService: Store retryableTokens in RetryContext
NotificationDeliveryService->>NotificationDeliveryService: retry attempt
else Delivery Success
deactivate NotificationDeliveryService
end
alt Max Retries Exceeded
NotificationDeliveryService->>SystemAlertPublisher: publish(SystemAlertEvent with error)
SystemAlertPublisher-->>NotificationDeliveryService: Alert logged/sent
end
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
|
ydking0911
approved these changes
Mar 26, 2026
This was referenced Apr 18, 2026
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Pull Request Template
📌 제목
📢 요약
🔗 연관 이슈: #72
🚀 PR 유형
✅ PR 체크리스트
📜 기타
Summary by CodeRabbit
Release Notes
New Features
Chores
Tests