11package com .oronaminc .join .websocket .api ;
22
3+ import java .security .Principal ;
4+
5+ import org .springframework .messaging .handler .annotation .DestinationVariable ;
6+ import org .springframework .messaging .handler .annotation .MessageMapping ;
7+ import org .springframework .messaging .handler .annotation .Payload ;
8+ import org .springframework .messaging .handler .annotation .SendTo ;
9+ import org .springframework .stereotype .Controller ;
10+
311import com .oronaminc .join .global .exception .ErrorCode ;
412import com .oronaminc .join .global .exception .ErrorException ;
513import com .oronaminc .join .global .ratelimit .RateLimitService ;
1119import com .oronaminc .join .question .dto .QuestionUpdateResponse ;
1220import com .oronaminc .join .question .service .QuestionService ;
1321import com .oronaminc .join .question .util .QuestionMapper ;
22+
1423import io .github .bucket4j .Bucket ;
1524import jakarta .validation .Valid ;
16- import java .security .Principal ;
1725import lombok .RequiredArgsConstructor ;
1826import lombok .extern .slf4j .Slf4j ;
19- import org .springframework .messaging .handler .annotation .DestinationVariable ;
20- import org .springframework .messaging .handler .annotation .MessageMapping ;
21- import org .springframework .messaging .handler .annotation .Payload ;
22- import org .springframework .messaging .handler .annotation .SendTo ;
23- import org .springframework .stereotype .Controller ;
2427
2528@ Slf4j
2629@ Controller
@@ -37,8 +40,12 @@ public QuestionCreateResponse createQuestion(
3740 @ Payload @ Valid QuestionRequest request ,
3841 Principal principal
3942 ) {
43+ log .debug ("수신한 메시지 = {}" , request .content ());
44+
4045 Long memberId = Long .valueOf (principal .getName ());
4146
47+ log .debug ("회원 아이디 = {}" , memberId );
48+
4249 Bucket bucket = rateLimitService .getBucket (RateLimitType .CREATE_QUESTION , roomId , memberId );
4350
4451 if (!bucket .tryConsume (1 )) {
@@ -47,7 +54,6 @@ public QuestionCreateResponse createQuestion(
4754
4855 Question question = questionService .create (roomId , memberId , request );
4956
50- log .info ("수신한 메시지 = {}" , request .content ());
5157
5258 return QuestionMapper .toQuestionCreateResponse (question );
5359 }
0 commit comments