private void createSingleNotice(NotificationDispatcher dispatcher, AlertTargetEntity target,
                                           List<AlertNoticeEntity> notices) {
    AlertNotification notification = buildNotificationFromTarget(target);
    notification.CallbackIds = new ArrayList<>(notices.size());
    List<AlertHistoryEntity> histories = new ArrayList<>(
        notices.size());

    // add callback IDs so that the notices can be marked as DELIVERED or
    // FAILED, and create a list of just the alert histories
    for (AlertNoticeEntity notice : notices) {
      AlertHistoryEntity history = notice.getAlertHistory();
      histories.add(history);

      notification.CallbackIds.add(notice.getUuid());
    }


    // populate the subject and body fields; if there is a problem
    // generating the content, then mark the notices as FAILED
    try {
      renderDigestNotificationContent(dispatcher, notification, histories, target);

      // dispatch
      DispatchRunnable runnable = new DispatchRunnable(dispatcher, notification);
      m_executor.execute(runnable);
    } catch (Exception exception) {
      LOG.error("Unable to create notification for alerts", exception);

      // there was a problem generating content for the target; mark all
      // notices as FAILED and skip this target
      // mark these as failed
      notification.Callback.onFailure(notification.CallbackIds);
    }
  }
Creates a single digest notification. Should be used when dispatcher supports digest.
@param dispatcher dispatches the created notifications.
@param target where notifications will be sent.
@param notices notices should be dispatched.
ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java