Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api: ✏️ 문의하기 응답속도 개선을 위한 이벤트 핸들러 비동기 처리 #106

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}
Loading