Skip to content

Commit

Permalink
fix: 문의하기 응답속도 개선을 위한 이벤트 핸들러 비동기 처리 (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
asn6878 authored Jun 5, 2024
1 parent 24b1427 commit 7210b0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

Expand All @@ -21,8 +22,9 @@ public class MailEventHandling {
* @param event {@link MailEvent}
*/
@TransactionalEventListener
@Async
public void handleMailEvent(MailEvent event) {
log.info("handleMailEvent: {}", event);
log.info("문의 메일 전송 이벤트 발생: {}", event);
googleMailSender.sendMail(event.email(), event.content(), event.category());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.scheduling.annotation.EnableAsync;

import java.util.Properties;

@Configuration
@EnableAsync
public class MailConfig {
@Value("${app.mail.host}")
private String host;
Expand Down Expand Up @@ -43,4 +45,4 @@ private Properties getMailProperties() {

return properties;
}
}
}

0 comments on commit 7210b0f

Please sign in to comment.