Interface NotificationService

All Superinterfaces:
Service

public interface NotificationService
extends Service
Service for sending Notifications.
  • Method Summary

    Modifier and Type Method Description
    void send​(java.util.Collection<Notification> notifications, PlatformUserContext platformUserContext)
    Sends the given Notifications as per the address/payload/etc specified inside the Notification objects.
  • Method Details

    • send

      void send​(java.util.Collection<Notification> notifications, PlatformUserContext platformUserContext)
      Sends the given Notifications as per the address/payload/etc specified inside the Notification objects.

      For example, to send an Email notification:

       EmailNotification notification = new EmailNotification();
       notification.getToAddresses().add("[email protected]");
       notification.setFromAddress("[email protected]");
       notification.setSubject("test message");
       notification.setBody("this is a test");
       
       List<Notification> notifications = new ArrayList<Notification>();
       notifications.add(notification);
       Services.get(NotificationService.class).send(notifications, userContext);
       
      The send operation will be execute asynchronously; this method will not block and wait for the SMTP connection to be made.