private boolean enable = true;
private final static ScheduledExecutorService executor = Executors.newScheduledThreadPool(5);
private String from;
public void _notify(Alert alert) {
Project project = projectService.findProject(alert.getProjectName());
if (project == null) {
logger.error("projectName of alert is null, alert={}", alert);
return;
}
SimpleMailMessage sm = new SimpleMailMessage();
sm.setText(alert.getContent());
sm.setSubject(alert.getTitle());
sm.setFrom(from);
String mailList=alert.getMetricDog().getMailList();
if(StringUtils.isBlank(mailList))
mailList = project.getMailList();
if (StringUtils.isNotBlank(mailList))
sm.setTo(mailList.split(","));
else
logger.error("send mail fail ,because mail list is null");
send(sm);