-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSendInvitationEmailService.java
More file actions
29 lines (26 loc) · 1.07 KB
/
SendInvitationEmailService.java
File metadata and controls
29 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package clap.server.application.service.admin;
import clap.server.application.port.outbound.email.SendEmailPort;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.concurrent.CompletableFuture;
@Slf4j
@Service
@RequiredArgsConstructor
public class SendInvitationEmailService {
private final SendEmailPort sendEmailPort;
@Async("emailExecutor")
public void sendInvitationEmail(String memberEmail, String receiverName, String initialPassword, String userNickname) {
CompletableFuture.runAsync(() -> {
try {
sendEmailPort.sendInvitationEmail(memberEmail, receiverName, initialPassword, userNickname);
} catch (Exception e) {
log.error("Failed to send new password email to: {}", memberEmail, e);
}
}).exceptionally(ex -> {
log.error("Unexpected error occurred while sending new password email", ex);
return null;
});
}
}