@Service public class EmailAlertListenerSupport extends Object implements AlertListener
If alert is activated then email is sent - there are default subject
and body
but if there are defined subject or body for specified alert
then these values are used. Also formats for subject
and body
can be changed.
Constructor and Description |
---|
EmailAlertListenerSupport() |
Modifier and Type | Method and Description |
---|---|
protected void |
doOnAlert(AlertInfo alert)
Does action when specified alert is activated.
|
protected String |
formatBody(AlertInfo alert,
long actualCount)
Formats custom body from specified alert.
|
protected String |
formatSubject(AlertInfo alert)
Formats custom subject from specified alert.
|
protected EmailService |
getEmailService()
Gets email service.
|
void |
onAlert(AlertInfo alert,
long actualCount)
Default implementation is to send email notification.
|
protected void |
sendEmail(String subject,
String body)
Sends notification email to administrators.
|
boolean |
supports(AlertInfo alert)
Does this listener support the specified alert?
|
public boolean supports(AlertInfo alert)
AlertListener
supports
in interface AlertListener
alert
- that is activatedtrue
if specified alert is supported by this listener otherwise false
CoreAlertsEnum
public final void onAlert(AlertInfo alert, long actualCount)
doOnAlert(AlertInfo)
with custom actions.onAlert
in interface AlertListener
alert
- the activated alertactualCount
- the actual count of itemsprotected void doOnAlert(AlertInfo alert)
alert
- the activated alertprotected String formatSubject(AlertInfo alert)
alert
- the activated alertprotected String formatBody(AlertInfo alert, long actualCount)
alert
- the activated alertactualCount
- the actual count of itemsprotected final void sendEmail(String subject, String body)
subject
- the subjectbody
- the bodyprotected final EmailService getEmailService()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.