Skip to content

feat(chat): 채팅방 채팅 메세지 전달 로직 디버깅 (#78)#170

Merged
jaehyeok-code merged 2 commits intodevfrom
feat/#78
Aug 26, 2025
Merged

feat(chat): 채팅방 채팅 메세지 전달 로직 디버깅 (#78)#170
jaehyeok-code merged 2 commits intodevfrom
feat/#78

Conversation

@jaehyeok-code
Copy link
Contributor

@jaehyeok-code jaehyeok-code commented Aug 26, 2025

Summary by CodeRabbit

  • 신기능
    • 채팅 알림/공지의 서버 간 팬아웃 전송이 활성화되어 여러 서버 환경에서도 메시지가 안정적으로 전달됩니다.
  • 개선/리팩터
    • 채팅 전송 경로가 방 단위로 일원화되어 메시지 라우팅이 간결해졌습니다.
    • 드래프트 실시간 갱신 채널이 /topic/draft.{id}로 정리되어 구독 일관성이 향상되었습니다.
    • Redis 구독 대상이 draft.*로 집중되어 불필요한 채널 수신을 줄였습니다.
  • 버그 수정
    • 선수 정보 업데이트 시 코드 값이 의도치 않게 변경되던 문제를 방지했습니다.

@jaehyeok-code jaehyeok-code self-assigned this Aug 26, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

채팅 전송 경로가 경로변수 기반으로 변경되고, Redis 퍼블리시/구독 흐름이 재배선되었습니다. 퍼블리셔는 UUID roomId와 노드 UUID 태깅을 도입했고, 서브스크라이버는 중복 회피 필터를 제거해 모든 수신 메시지를 STOMP로 전달합니다. 드래프트 알림 채널과 Redis 구독 패턴도 /topic/draft.*로 통일되었습니다.

Changes

Cohort / File(s) Summary
Chat Pub/Sub Core
.../domain/chat/bus/ChatRedisPublisher.java, .../domain/chat/bus/ChatRedisSubscriber.java
Publisher: room 식별자 타입을 UUID로 변경, 페이로드에 _src로 노드 UUID 태깅, 채널을 ChatChannels.roomChannel(roomId)로 계산, 예외 삼킴 처리. Subscriber: 동일 노드 기원 필터 제거로 모든 수신 메시지를 STOMP로 전달.
Chat Controllers
.../domain/chat/controller/ChatMessagingController.java, .../domain/chat/controller/ChatNotificationController.java
MessagingController: @MessageMapping("/chat/{roomId}/send"), @DestinationVariable UUID roomId 도입, 로컬 브로드캐스트 제거, publishToRoom(roomId, payload)로 단순화. NotificationController: STOMP 브로드캐스트 후 Redis 퍼블리시를 실제 수행(주석 해제).
Notification Service
.../domain/chat/service/Impl/ChatNotificationServiceImpl.java
각 roomId에 대해 STOMP 전송 이후 Redis 퍼블리시 실행(주석 해제).
Draft Messaging & Redis Config
.../global/configuration/RedisConfig.java, .../global/redis/RedisSubscriber.java
RedisConfig: PatternTopic("draft.*")만 구독하고 chat/* 구독 제거. RedisSubscriber: STOMP 대상 경로를 /topic/draft.{draftId}로 변경.
Entities
.../domain/player/entity/Player.java, .../domain/chat/entity/ChatReadState.java
Player: updatePlayer에서 this.code 갱신 제거, 불필요한 중복 import 정리. ChatReadState: 어노테이션/중괄호 정렬(동작 동일).
WebSocket/OpenAPI Config
.../global/configuration/UnifiedWebSocketConfig.java, .../global/configuration/OpenApiConfig.java
UnifiedWebSocketConfig: 주석 처리되어 있던 스케줄러/하트비트 설정 블록 삭제(런타임 불변). OpenApiConfig: 들여쓰기 및 포맷만 변경.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client (STOMP)
  participant WS as WebSocket Broker
  participant Ctl as ChatMessagingController
  participant Pub as ChatRedisPublisher
  participant Redis as Redis (pub/sub)
  participant Sub as ChatRedisSubscriber

  C->>WS: SEND /app/chat/{roomId}/send
  WS->>Ctl: @MessageMapping("/chat/{roomId}/send")
  rect rgba(200,240,255,0.3)
    note right of Ctl: roomId로 권한/저장 처리
    Ctl->>Pub: publishToRoom(roomId, payload+meta)
    Pub->>Redis: PUBLISH chat.<roomId> with {"_src": nodeId, ...}
  end
  Redis-->>Sub: MESSAGE chat.<roomId>
  rect rgba(220,255,220,0.3)
    note right of Sub: 원본 노드 필터링 없이 전달
    Sub->>WS: convertAndSend /topic/chat.{roomId}
    WS-->>C: MESSAGE /topic/chat.{roomId}
  end
Loading
sequenceDiagram
  autonumber
  participant S as Draft Emitter
  participant Redis as Redis (pub/sub)
  participant RSub as RedisSubscriber
  participant WS as WebSocket Broker
  participant U as Client (STOMP)

  S->>Redis: PUBLISH draft.* channel
  Redis-->>RSub: onMessage(draftId, payload)
  RSub->>WS: convertAndSend /topic/draft.{draftId}
  WS-->>U: MESSAGE /topic/draft.{draftId}
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • hwichoi0317
  • Kim-Jaehyun0328
  • wjkim9
  • roode1017

Poem

깡총, 깡총—토끼가 코딩방을 순찰해요!
방 번호는 UUID, 길 잃을 일은 없대요.
Redis에 톡! 톡! 중복 필터는 안녕—
드래프트는 /topic으로 쓩—
버그야 숨지 마, 니 발자국 다 보였거든! 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f227fa9 and d37d710.

📒 Files selected for processing (11)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/bus/ChatRedisPublisher.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/bus/ChatRedisSubscriber.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/controller/ChatMessagingController.java (2 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/controller/ChatNotificationController.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/entity/ChatReadState.java (2 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/service/Impl/ChatNotificationServiceImpl.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/player/entity/Player.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/global/configuration/OpenApiConfig.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/global/configuration/RedisConfig.java (0 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/global/configuration/UnifiedWebSocketConfig.java (0 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/global/redis/RedisSubscriber.java (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#78

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant