org.ikasan.framework.monitor
Class MonitorEmailNotifier

java.lang.Object
  extended by org.ikasan.framework.monitor.AbstractMonitorListener
      extended by org.ikasan.framework.monitor.MonitorEmailNotifier
All Implemented Interfaces:
MonitorListener

public class MonitorEmailNotifier
extends AbstractMonitorListener

Monitor listener implementation which sends emails for state changes. By default, this monitor will generate an email if the initiator its monitoring has current state stoppedInError. To override this behavior, configure the monitor with a Map of required reported states to email distributions list(s) to notify if current state is a match.

Author:
Ikasan Development Team

Constructor Summary
MonitorEmailNotifier(String name, org.springframework.mail.javamail.JavaMailSender mailSender, List<String> to, String environment)
          Creates a monitor that notifies configured recipients if initiator state is stoppedInError only.
MonitorEmailNotifier(String name, org.springframework.mail.javamail.JavaMailSender mailSender, Map<String,List<String>> stateToDistributionListMap, String environment)
          Creates a monitor that matches current initiator state to a map of pre-configured states to recipient list.
MonitorEmailNotifier(String name, org.springframework.mail.javamail.JavaMailSender mailSender, String to, String environment)
          Create a monitor that notifies a single recipient if initaitor state is stoppedInError.
 
Method Summary
 void notify(String state)
          Notification of a change
 void setBody(String body)
          Setter for mail body text.
 void setFrom(String from)
          Setter for mail from field
 
Methods inherited from class org.ikasan.framework.monitor.AbstractMonitorListener
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitorEmailNotifier

public MonitorEmailNotifier(String name,
                            org.springframework.mail.javamail.JavaMailSender mailSender,
                            String to,
                            String environment)
Create a monitor that notifies a single recipient if initaitor state is stoppedInError.

Parameters:
name - Monitor name
mailSender - Mail sender
to - email distribution list
environment - Runtime environment

MonitorEmailNotifier

public MonitorEmailNotifier(String name,
                            org.springframework.mail.javamail.JavaMailSender mailSender,
                            List<String> to,
                            String environment)
Creates a monitor that notifies configured recipients if initiator state is stoppedInError only.

Parameters:
name - Monitor name
mailSender - Mail sender
to - email distribution list
environment - Runtime environment

MonitorEmailNotifier

public MonitorEmailNotifier(String name,
                            org.springframework.mail.javamail.JavaMailSender mailSender,
                            Map<String,List<String>> stateToDistributionListMap,
                            String environment)
Creates a monitor that matches current initiator state to a map of pre-configured states to recipient list.

Parameters:
name - Monitor name
mailSender - Mail sender
stateToDistributionListMap - map of initiator states to recipient list
environment - Runtime envirnoment
Method Detail

setBody

public void setBody(String body)
Setter for mail body text.

Parameters:
body - email message text content

setFrom

public void setFrom(String from)
Setter for mail from field

Parameters:
from - sender email address

notify

public void notify(String state)
Description copied from interface: MonitorListener
Notification of a change

Specified by:
notify in interface MonitorListener
Specified by:
notify in class AbstractMonitorListener
Parameters:
state - The change


Copyright © 2007-2012 Ikasan. All Rights Reserved.