Class EmailNotificationService

All Implemented Interfaces:
NotificationService, ConfigurableComponent

public class EmailNotificationService extends AbstractNotificationService
  • Field Details

  • Constructor Details

    • EmailNotificationService

      public EmailNotificationService()
  • Method Details

    • getSupportedPropertyDescriptors

      protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class AbstractConfigurableComponent
    • customValidate

      protected Collection<ValidationResult> customValidate(ValidationContext context)
      Overrides:
      customValidate in class AbstractConfigurableComponent
    • notify

      public void notify(NotificationContext context, NotificationType notificationType, String subject, String messageText) throws NotificationFailedException
      Description copied from interface: NotificationService
      Notifies the configured recipients of some event
      Parameters:
      context - the context that is relevant for this notification
      notificationType - the notification type
      subject - the subject of the message
      messageText - 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

      private Properties getMailProperties(NotificationContext context)
      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

      private javax.mail.Session createMailSession(Properties properties)
      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