Skip to content

채팅방 채팅 메세지 전달 로직 디버깅 (#78)#168

Merged
jaehyeok-code merged 2 commits intomainfrom
dev
Aug 26, 2025
Merged

채팅방 채팅 메세지 전달 로직 디버깅 (#78)#168
jaehyeok-code merged 2 commits intomainfrom
dev

Conversation

@jaehyeok-code
Copy link
Contributor

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

Summary by CodeRabbit

  • 신기능
    • 채팅 메시지에 생성 시각 정보가 포함되어 클라이언트에서 전송 시간 표시가 가능합니다.
  • 버그 수정
    • 채팅 전송 시 방 식별을 요청 본문 기준으로 통일해 잘못된 방으로 전달되던 문제를 해소했습니다.
    • 실시간 채팅 중계 경로를 정비해 구독·전달의 신뢰성을 높였습니다.
  • 작업
    • 서버 간 채팅 채널 구독을 확대해 멀티 노드 환경에서 메시지 수신 범위를 넓혔습니다.
    • 디버그 로그를 보강해 장애 진단이 쉬워졌습니다.

@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

채팅 전송 흐름을 경로 변수(roomId)에서 요청 본문(req.getRoomId()) 기반으로 변경하고, Redis 채널/구독 패턴을 chat.* 및 chat/*로 조정했습니다. 메시지 브로커 목적지와 Redis 수신자 라우팅을 갱신했으며, 예외 전파(JsonProcessingException) 및 디버그 출력이 추가되었습니다.

Changes

Cohort / File(s) Summary
Chat publish flow
backendProject/.../chat/controller/ChatMessagingController.java, backendProject/.../chat/bus/ChatRedisPublisher.java
send 핸들러가 @MessageMapping("/chat/send")로 변경되고 roomId는 req.getRoomId() 사용. Redis 채널을 chat.{roomId}로 발행. SimpMessagingTemplate 목적지는 /topic/chat/{roomId} 유지. ChatRedisPublisher.publishToRoomthrows JsonProcessingException 추가, 내부 try-catch 제거, _src 주석 처리, 디버그 출력 추가.
Redis subscription & routing
backendProject/.../global/configuration/RedisConfig.java, backendProject/.../global/redis/RedisSubscriber.java
RedisMessageListenerContainer에 PatternTopic("chat/*") 구독 추가(기존 draft.* 유지). RedisSubscriber.onMessage가 STOMP 목적지를 "/chat/" + draftId로 변경(기존 "/topic/draft." + draftId" 주석 처리).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant MC as ChatMessagingController
  participant ST as SimpMessagingTemplate
  participant PR as ChatRedisPublisher
  participant R as Redis
  participant RS as RedisSubscriber
  participant SUB as Subscribed Clients

  rect rgba(230,245,255,0.5)
    Note over C,MC: 채팅 전송 (roomId는 요청 바디에서)
    C->>MC: SEND /chat/send (ChatSendRequest{roomId, ...})
    MC->>MC: 멤버십 검증, 메시지 저장
    MC->>ST: convertAndSend(/topic/chat/{roomId}, payload+createdAt)
  end

  rect rgba(240,255,240,0.5)
    MC->>PR: publishToRoom("chat.{roomId}", payload) [throws JsonProcessingException]
    PR->>R: PUBLISH channel=chat.{roomId}, json
  end

  rect rgba(255,245,230,0.5)
    R-->>RS: Message on chat/* (PatternTopic)
    RS->>ST: convertAndSend(/chat/{id}, parsedMessage)
    ST-->>SUB: Broadcast
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • hwichoi0317
  • Kim-Jaehyun0328
  • wjkim9
  • roode1017

Poem

토끼는 채팅을 톡톡, 귀를 쫑긋 세우고
방 번호는 편지 속, 봉투에서 찾고요
chat.*로 뛰어가 퐁당, 메시지 전달하고
createdAt 반짝반짝, 시간도 챙겨 넣고
삐빅—노드들아 받아라! 오늘도 큐윙 🥕

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 c2ab8b4 and 7c14b7d.

📒 Files selected for processing (4)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/bus/ChatRedisPublisher.java (2 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/controller/ChatMessagingController.java (5 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/global/configuration/RedisConfig.java (1 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 dev

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