@Subscribe
  @AllowConcurrentEvents
  public void onAlertEvent(AlertStateChangeEvent event) {
    LOG.debug("Received event {}", event);

    Alert alert = event.getAlert();
    AlertCurrentEntity current = event.getCurrentAlert();
    AlertHistoryEntity history = event.getNewHistoricalEntry();
    AlertDefinitionEntity definition = history.getAlertDefinition();

    // log to the alert audit log so there is physical record even if
    // definitions and historical enties are removed
    ALERT_LOG.info(ALERT_LOG_MESSAGE, alert.getState(), current.getFirmness(),
        definition.getServiceName(), definition.getDefinitionName(),
        definition.getLabel(), alert.getText());

    // do nothing if the firmness is SOFT
    if (current.getFirmness() == AlertFirmness.SOFT) {
      return;
    }

    // OK alerts are always HARD, so we need to catch the case where we are
    // coming from a SOFT non-OK to an OK; in these cases we should not alert
    //
    // New State = OK
    // Old Firmness = SOFT
    if (history.getAlertState() == AlertState.OK && event.getFromFirmness() == AlertFirmness.SOFT) {
      return;
    }

    // don't create any outbound alert notices if in MM
    AlertCurrentEntity currentAlert = event.getCurrentAlert();
    if (null != currentAlert
        && currentAlert.getMaintenanceState() != MaintenanceState.OFF) {
      return;
    }

    List<AlertGroupEntity> groups = m_alertsDispatchDao.findGroupsByDefinition(definition);
    List<AlertNoticeEntity> notices = new LinkedList<>();

    // for each group, determine if there are any targets that need to receive
    // a notification about the alert state change event
    for (AlertGroupEntity group : groups) {
      Set<AlertTargetEntity> targets = group.getAlertTargets();
      if (null == targets || targets.size() == 0) {
        continue;
      }

      for (AlertTargetEntity target : targets) {
        if (!canDispatch(target, history, definition)) {
          continue;
        }

        AlertNoticeEntity notice = new AlertNoticeEntity();
        notice.setUuid(UUID.randomUUID().toString());
        notice.setAlertTarget(target);
        notice.setAlertHistory(event.getNewHistoricalEntry());
        notice.setNotifyState(NotificationState.PENDING);
        notices.add(notice);
      }
    }

    // create notices if there are any to create
    if (!notices.isEmpty()) {
      m_alertsDispatchDao.createNotices(notices);
    }
  }
Listens for when an alert's state has changed and creates
{@link AlertNoticeEntity} instances when appropriate to notify
{@link AlertTargetEntity}.
<p/>
{@link AlertNoticeEntity} are only created when the target has the
{@link AlertState} in its list of states.
ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java