提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.mq.producer.mail; |
H |
2 |
|
|
3 |
import com.iailab.module.system.mq.message.mail.MailSendMessage; |
|
4 |
import lombok.extern.slf4j.Slf4j; |
|
5 |
import org.springframework.context.ApplicationContext; |
|
6 |
import org.springframework.stereotype.Component; |
|
7 |
|
|
8 |
import javax.annotation.Resource; |
|
9 |
|
|
10 |
/** |
|
11 |
* Mail 邮件相关消息的 Producer |
|
12 |
* |
|
13 |
* @author wangjingyi |
|
14 |
* @since 2021/4/19 13:33 |
|
15 |
*/ |
|
16 |
@Slf4j |
|
17 |
@Component |
|
18 |
public class MailProducer { |
|
19 |
|
|
20 |
@Resource |
|
21 |
private ApplicationContext applicationContext; |
|
22 |
|
|
23 |
/** |
|
24 |
* 发送 {@link MailSendMessage} 消息 |
|
25 |
* |
|
26 |
* @param sendLogId 发送日志编码 |
|
27 |
* @param mail 接收邮件地址 |
|
28 |
* @param accountId 邮件账号编号 |
|
29 |
* @param nickname 邮件发件人 |
|
30 |
* @param title 邮件标题 |
|
31 |
* @param content 邮件内容 |
|
32 |
*/ |
|
33 |
public void sendMailSendMessage(Long sendLogId, String mail, Long accountId, |
|
34 |
String nickname, String title, String content) { |
|
35 |
MailSendMessage message = new MailSendMessage() |
|
36 |
.setLogId(sendLogId).setMail(mail).setAccountId(accountId) |
|
37 |
.setNickname(nickname).setTitle(title).setContent(content); |
|
38 |
applicationContext.publishEvent(message); |
|
39 |
} |
|
40 |
|
|
41 |
} |