@Override public void onEvent(Event event) { ThresholdAlertEvent alertEvent = (ThresholdAlertEvent) event; ThresholdAlarmMeta metaInfo = alertEvent.getAlarmMeta(); String title = buildAlarmTitle(metaInfo); String content = buildEmailAlarmContent(metaInfo); String alertType = metaInfo.getDuration().getAlarm().toLowerCase(); String ruleType = metaInfo.getType(); if (alertType != null && alertType.length() > 0) { String[] types = alertType.split(","); for (String type : types) { if (type.equalsIgnoreCase(AlertInfo.EMAIL)) { List<String> emailAddress = m_ruleManager.queryUserMailsByRuleId(metaInfo.getRuleId()); AlertInfo info = buildAlertInfo(metaInfo, title, content, ruleType, AlertInfo.EMAIL_TYPE); info.setMails(emailAddress); m_alertManager.addAlarmInfo(info); } if (type.equalsIgnoreCase(AlertInfo.SMS)) { List<String> emailAddress = m_ruleManager.queryUserMailsByRuleId(metaInfo.getRuleId()); AlertInfo info = buildAlertInfo(metaInfo, title + "[SMS]", content, ruleType, AlertInfo.EMAIL_TYPE); info.setMails(emailAddress); m_alertManager.addAlarmInfo(info); List<String> phoneAddress = m_ruleManager.queryUserPhonesByRuleId(metaInfo.getRuleId()); AlertInfo smsInfo = buildAlertInfo(metaInfo, title, content, ruleType, AlertInfo.SMS_TYPE); smsInfo.setPhones(phoneAddress); m_alertManager.addAlarmInfo(smsInfo); } } } }