특정 비즈니스 로직에 있어서 메일 서비스는 동기적으로 실행을 하는 것보다 비동기적으로 수행되는 경우가 많습니다.클라이언트에게 화면이 멈춰있는 듯한 경험을 할 수 있기 때문입니다. 예를 들어 간단하게 A작업이 있다면, A작업이 수행되어 화면에 반영되고 부가적으로 메일 발송이 이루어진다고 할 때동기적으로 작동하게 된다면 1. 클라이언트 A작업을 수행2. 백엔드 서버에서는 A작업을 수행하면서 동시에 B(메일발송)작업 수행for(MailModel mailModel : mailList) { // A 작업 수행 for (User user : userList) { // B 작업 수행(메일 발송) }}3. B작업이 끝나기 전 까지는 A작업도 계속 멈춰있게 됩니다. 비동기 도입 고려비동기 로직을 고민할..
Spring관련 기술/서버개발
소켓 통신을 심심해서 구현해보고 찾아보던 와중 저번에는 채팅 어플리케이션을 gpt와 함께 SSE 방식을 사용해서 구현해보았는데 이번에는 spring의 socket 라이브러리인 stomp을 통해 구현해보았다 @Configuration@EnableWebSocketMessageBroker@RequiredArgsConstructorpublic class WssConfig implements WebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry registry) { // 구독 경로 설정 registry.enableSimpleBroker("/sub")..

2024-08-31T15:23:38.935+09:00 INFO 19976 --- [common] [ main] c.l.feign.KakaoClientIntegrationTest : Started KakaoClientIntegrationTest in 6.552 seconds (process running for 9.803) OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended com.library.ApiException at com.library.feign.KakaoErrorDecoder.decode(KakaoErrorDecode..
@RequiredArgsConstructor@Componentpublic class ApplicationRunner implements CommandLineRunner { private final DailyStatRepository dailyStatRepository; @Override public void run(String... args) throws Exception { DailyStat stat1 = new DailyStat("HTTP", LocalDateTime.now()); DailyStat stat2 = new DailyStat("HTTP", LocalDateTime.now()); DailyStat stat3 = new DailyStat(..
MethodArgumentTypeMismatchException 파라미터의 Type(형식)이 제대로 넘어오지 않았을 때. LocalDate 타입으로 넘어와야하는데 String이나 int로 넘어온 경우 @ExceptionHandler(MethodArgumentTypeMismatchException.class) public ResponseEntity handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e) { log.error("MethodArgumentTypeMismatch Exception occurred. message={}", e.getMessage()); return Resp..

MissingServletRequestParameterException 필수 파라미터가 아예 빠져있을 때 발생 @ExceptionHandler(MissingServletRequestParameterException.class) public ResponseEntity handleMissingServletRequestParameterException(MissingServletRequestParameterException e) { log.error("MissingServletRequestParameter Exception occurred. parameterName={} message={}, className={}", e.getParameterName(), e.getMessage(), ..