lib/alerts/alerts.js
function handler (eventDetails){
  var Alert = models.getModels().Alert;
  logger.logger.trace(loggerPrefix +'Processing Alerts for Event: ', eventDetails);

  Alert.queryAlerts(eventDetails.uid, eventDetails.env, eventDetails.domain, function(err, alerts){
    if(err) {
      logger.logger.warn({ error:err }, loggerPrefix +'Failed to query Alerts for uid and env', uid, env);
    } else {
      if(alerts && alerts.length > 0){
        logger.logger.trace(loggerPrefix +'Found ['+ alerts.length +'] Alerts. Matching and send emails', alerts);
        matchAndIssueAlertEmails(eventDetails, alerts);
      } else {
        logger.logger.trace(loggerPrefix +'No Alerts for event. No emails to send.');
      }
    }
  });
}
function handler (eventDetails){
  var Alert = models.getModels().Alert;
  logger.logger.trace(loggerPrefix +'Processing Alerts for Event: ', eventDetails);

  Alert.queryAlerts(eventDetails.uid, eventDetails.env, eventDetails.domain, function(err, alerts){
    if(err) {
      logger.logger.warn({ error:err }, loggerPrefix +'Failed to query Alerts for uid and env', uid, env);
    } else {
      if(alerts && alerts.length > 0){
        logger.logger.trace(loggerPrefix +'Found ['+ alerts.length +'] Alerts. Matching and send emails', alerts);
        matchAndIssueAlertEmails(eventDetails, alerts);
      } else {
        logger.logger.trace(loggerPrefix +'No Alerts for event. No emails to send.');
      }
    }
  });
}
function handler ( eventDetails ) { var Alert = models . getModels ( ) . Alert ; logger . logger . trace ( loggerPrefix + 'Processing Alerts for Event: ' , eventDetails ) ; Alert . queryAlerts ( eventDetails . uid , eventDetails . env , eventDetails . domain , function ( err , alerts ) { if ( err ) { logger . logger . warn ( { error : err } , loggerPrefix + 'Failed to query Alerts for uid and env' , uid , env ) ; } else { if ( alerts && alerts . length > 0 ) { logger . logger . trace ( loggerPrefix + 'Found [' + alerts . length + '] Alerts. Matching and send emails' , alerts ) ; matchAndIssueAlertEmails ( eventDetails , alerts ) ; } else { logger . logger . trace ( loggerPrefix + 'No Alerts for event. No emails to send.' ) ; } } } ) ; }
Handle an EVENT. We will take the EVENT details,
match the Alerts in Mongo that have been setup and
if a match is found, then send the email from the MBaaS
@param msg
@param headers
@param info
@param cb
Handle an EVENT . We will take the EVENT details match the Alerts in Mongo that have been setup and if a match is found then send the email from the MBaaS