rename email msg subject

pull/923/head
baymax55 3 years ago
parent 3ef45f2b51
commit 8d069c941f

@ -69,8 +69,9 @@ public class EmailSendMessageHandler implements SendMessageHandler<AlarmNotifyRe
dataModel.put("interval", notifyConfig.getInterval().toString()); dataModel.put("interval", notifyConfig.getInterval().toString());
String emailAlarmTxt = Singleton.get(emailAlarmTxtKey, () -> FileUtil.readUtf8String(emailAlarmTxtKey)); String emailAlarmTxt = Singleton.get(emailAlarmTxtKey, () -> FileUtil.readUtf8String(emailAlarmTxtKey));
String renderedEmailAlarmTxt = render(dataModel, emailAlarmTxt); String renderedEmailAlarmTxt = render(dataModel, emailAlarmTxt);
String alarmSubject = render(dataModel, EmailAlarmConstants.Email_ALARM_TITLE);
String[] recipients = notifyConfig.getReceives().split(","); String[] recipients = notifyConfig.getReceives().split(",");
execute(recipients, EmailAlarmConstants.Email_ALARM_TITLE, renderedEmailAlarmTxt); execute(recipients, alarmSubject, renderedEmailAlarmTxt);
} catch (Exception e) { } catch (Exception e) {
log.error("Email failed to send message", e); log.error("Email failed to send message", e);
} }
@ -81,10 +82,11 @@ public class EmailSendMessageHandler implements SendMessageHandler<AlarmNotifyRe
try { try {
String emailConfigTxtKey = "message/robot/dynamic-thread-pool/email-config.ftl"; String emailConfigTxtKey = "message/robot/dynamic-thread-pool/email-config.ftl";
Map<String, String> dataModel = getDataModel(changeParameterNotifyRequest); Map<String, String> dataModel = getDataModel(changeParameterNotifyRequest);
String emailAlarmTxt = Singleton.get(emailConfigTxtKey, () -> FileUtil.readUtf8String(emailConfigTxtKey)); String emailConfigTxt = Singleton.get(emailConfigTxtKey, () -> FileUtil.readUtf8String(emailConfigTxtKey));
String renderedEmailAlarmTxt = render(dataModel, emailAlarmTxt); String renderedEmailConfigTxt = render(dataModel, emailConfigTxt);
String configSubject = render(dataModel, EmailAlarmConstants.Email_NOTICE_TITLE);
String[] recipients = notifyConfig.getReceives().split(","); String[] recipients = notifyConfig.getReceives().split(",");
execute(recipients, EmailAlarmConstants.Email_NOTICE_TITLE, renderedEmailAlarmTxt); execute(recipients, configSubject, renderedEmailConfigTxt);
} catch (Exception e) { } catch (Exception e) {
log.error("Email failed to send message", e); log.error("Email failed to send message", e);
} }

@ -25,10 +25,10 @@ public class EmailAlarmConstants {
/** /**
* Thread Pool Alert Notification Title * Thread Pool Alert Notification Title
*/ */
public static final String Email_ALARM_TITLE = "动态线程池告警"; public static String Email_ALARM_TITLE = "【Hippo4J】${active}-${threadPoolId} 线程池 ${notifyTypeEnum} 预警";
/** /**
* Thread pool parameter change notification title * Thread pool parameter change notification title
*/ */
public static final String Email_NOTICE_TITLE = "动态线程池通知"; public static String Email_NOTICE_TITLE = "【Hippo4J】${active}-${threadPoolId} 线程池参数变更通知";
} }

@ -1,8 +1,3 @@
<style>
li {
list-style-type: none;
}
</style>
<span style="color: rgb(255, 0, 0);">[警报] </span>${active} - 动态线程池运行告警(${notifyTypeEnum} <span style="color: rgb(255, 0, 0);">[警报] </span>${active} - 动态线程池运行告警(${notifyTypeEnum}
<ul> <ul>
<li>线程池ID<span style="color: rgb(160, 0, 0);">${threadPoolId}</span></li> <li>线程池ID<span style="color: rgb(160, 0, 0);">${threadPoolId}</span></li>
@ -24,4 +19,10 @@
<li>提示:${interval} 分钟内此线程池不会重复告警(可配置)</li> <li>提示:${interval} 分钟内此线程池不会重复告警(可配置)</li>
</ul> </ul>
<b> 播报时间:${date} </b> <b> 播报时间:${date} </b>
<style>
li {
list-style-type: none;
}
</style>

@ -1,6 +1,3 @@
<style>
li{list-style-type:none;}
</style>
<span style="color: rgb(0, 240, 0); ">[通知] </span>${active} - 动态线程池参数变更 <span style="color: rgb(0, 240, 0); ">[通知] </span>${active} - 动态线程池参数变更
<ul> <ul>
<li>线程池ID<span style="color: rgb(160, 0, 0);">${threadPoolId}</span></li> <li>线程池ID<span style="color: rgb(160, 0, 0);">${threadPoolId}</span></li>
@ -19,3 +16,9 @@
</ul> </ul>
<b> 播报时间:${date} </b> <b> 播报时间:${date} </b>
<style>
li {
list-style-type: none;
}
</style>

Loading…
Cancel
Save