Skip to content

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

Merged
jaehyeok-code merged 1 commit intodevfrom
feat/#78
Aug 25, 2025
Merged

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

Conversation

@jaehyeok-code
Copy link
Contributor

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

Summary by CodeRabbit

  • Bug Fixes
    • 채팅 전송 시 더 이상 임시 값이 아닌 실제 저장된 메시지의 내용·유형·생성 시간이 전송/표시됩니다.
    • 메시지 ID와 타임스탬프가 일관되게 반영되어 재연결·다중 클라이언트 환경에서 표시 오류가 줄었습니다.
    • 전송 과정에 트랜잭션을 적용해 메시지 누락·중복 가능성을 낮추고 신뢰성을 개선했습니다.

@coderabbitai
Copy link

coderabbitai bot commented Aug 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

ChatMessagingController의 send 핸들러에 @transactional을 추가하고, 메시지를 실제로 저장한 후 저장 결과로부터 응답 페이로드를 구성하도록 변경했다. 이후 STOMP 브로드캐스트와 Redis 퍼블리시 경로는 유지된다. 메서드 시그니처는 동일하며 어노테이션만 추가됐다.

Changes

Cohort / File(s) Change Summary
채팅 전송 트랜잭션/영속화
backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/controller/ChatMessagingController.java
send 메서드에 @Transactional 추가. chatMessageService.saveUserMessage(roomId, userId, req.getContent())로 영속화 후, 반환된 ChatMessage 기반으로 페이로드(id, type, content, createdAt 등) 구성. STOMP /topic/chat/{roomId} 전송과 Redis 퍼블리시는 기존 유지.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Client
    participant Controller as ChatMessagingController
    participant Service as ChatMessageService
    participant Broker as MessagingTemplate (STOMP)
    participant Redis as ChatRedisPublisher

    Client->>Controller: SEND /app/chat/{roomId} (ChatSendRequest)
    rect rgba(200,230,255,0.25)
    note right of Controller: @Transactional
    Controller->>Service: saveUserMessage(roomId, userId, content)
    Service-->>Controller: ChatMessage(saved)
    end
    Controller->>Broker: convertAndSend(/topic/chat/{roomId}, payload from saved)
    Controller->>Redis: publish(payload)
    Broker-->>Client: MESSAGE /topic/chat/{roomId}
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • hwichoi0317
  • Kim-Jaehyun0328
  • wjkim9
  • roode1017

Poem

삐빅, 토끼는 톡톡 메시지 저장해요 📝
임시 말풍선은 이제 그만, DB에 꾹—담아요
트랜잭션 포근히 감싸고
브로커-레디스 타고 폴짝!
방마다 번지는 말의 씨앗,
밤하늘 별처럼 반짝✨


📜 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 6fc4c7c and d0a025b.

📒 Files selected for processing (1)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/controller/ChatMessagingController.java (3 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