Skip to content

Commit

Permalink
feat: 웹소켓 블로킹 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kimhalin committed Sep 2, 2023
1 parent 6786565 commit 2c1972e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.springframework.http.ResponseEntity;
import org.springframework.messaging.handler.annotation.DestinationVariable;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -29,12 +28,11 @@ public class CodeController {

private final RabbitTemplate rabbitTemplate;
private final CodeService codeService;

@MessageMapping("code.message.{postId}")
public void send(@RequestBody Operation operation, @DestinationVariable Long postId) {

log.info("postId = {}", postId);
rabbitTemplate.convertAndSend(EXCHANGE_NAME, "code."+ postId, operation); //code.*로 바인딩된 큐로 보냄
// 코드 변경 메시지 전송
rabbitTemplate.convertAndSend(EXCHANGE_NAME, "code." + postId, operation);
}

@RabbitListener(queues = CODE_QUEUE_NAME)
Expand All @@ -49,5 +47,5 @@ public ResponseEntity<ResultResponse> compile(
CodingDto.CompilerResponse response = codeService.getCompileResponse(request);
return ResponseEntity.ok(ResultResponse.of(ResultCode.GET_COMPILE_RESULT, response));
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@


import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Operation {

private String text;

private boolean typing;
}

0 comments on commit 2c1972e

Please sign in to comment.