Class EmailNotificationService
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.bootstrap.notification.AbstractNotificationService
org.apache.nifi.bootstrap.notification.email.EmailNotificationService
- All Implemented Interfaces:
NotificationService,ConfigurableComponent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorprivate static final Map<String, PropertyDescriptor> Mapping of the mail properties to the NiFi PropertyDescriptors that will be evaluated at runtimestatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate javax.mail.SessioncreateMailSession(Properties properties) Based on the input properties, determine whether an authenticate or unauthenticated session should be used.protected Collection<ValidationResult> customValidate(ValidationContext context) private PropertiesgetMailProperties(NotificationContext context) Uses the mapping of javax.mail properties to NiFi PropertyDescriptors to build the required Properties object to be used for sending this emailprotected List<PropertyDescriptor> voidnotify(NotificationContext context, NotificationType notificationType, String subject, String messageText) Notifies the configured recipients of some eventprivate static javax.mail.internet.InternetAddress[]toInetAddresses(String val) Creates an array of 0 or more InternetAddresses for the given StringMethods inherited from class org.apache.nifi.bootstrap.notification.AbstractNotificationService
getIdentifier, init, initializeMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, toString, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
-
Field Details
-
SMTP_HOSTNAME
-
SMTP_PORT
-
SMTP_USERNAME
-
SMTP_PASSWORD
-
SMTP_AUTH
-
SMTP_TLS
-
SMTP_SOCKET_FACTORY
-
HEADER_XMAILER
-
CONTENT_TYPE
-
FROM
-
TO
-
CC
-
BCC
-
propertyToContext
Mapping of the mail properties to the NiFi PropertyDescriptors that will be evaluated at runtime
-
-
Constructor Details
-
EmailNotificationService
public EmailNotificationService()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classAbstractConfigurableComponent
-
customValidate
- Overrides:
customValidatein classAbstractConfigurableComponent
-
notify
public void notify(NotificationContext context, NotificationType notificationType, String subject, String messageText) throws NotificationFailedException Description copied from interface:NotificationServiceNotifies the configured recipients of some event- Parameters:
context- the context that is relevant for this notificationnotificationType- the notification typesubject- the subject of the messagemessageText- the message to be provided to recipients- Throws:
NotificationFailedException
-
toInetAddresses
private static javax.mail.internet.InternetAddress[] toInetAddresses(String val) throws javax.mail.internet.AddressException Creates an array of 0 or more InternetAddresses for the given String- Parameters:
val- the String to parse for InternetAddresses- Returns:
- an array of 0 or more InetAddresses
- Throws:
javax.mail.internet.AddressException- if val contains an invalid address
-
getMailProperties
Uses the mapping of javax.mail properties to NiFi PropertyDescriptors to build the required Properties object to be used for sending this email- Parameters:
context- context- Returns:
- mail properties
-
createMailSession
Based on the input properties, determine whether an authenticate or unauthenticated session should be used. If authenticated, creates a Password Authenticator for use in sending the email.- Parameters:
properties- mail properties- Returns:
- session
-