Support and Documentation

Notification lifecycle

Brightspot invokes the following process when processing notifications.

  1. An event occurs (e.g., a ToolUser publishes a Content).

  2. Create a publisher with all the message context information for the event (content ID, user ID, etc.)

  3. Invoke the publisher's Publisher#publishNotification/Async method, which performs all of the following steps.

  4. Publisher fetches a list of all possible receivers by invoking Publisher#getReceivers.

  5. For each receiver:

    1. Fetch the set of subscriptions with Receiver#getReceiverSubscriptions.

    2. For each subscription:

      1. Check if the following are true:

        • Subscription matches the publisher's generic type argument <S> in Publisher<S, C>.

        • Subscription#shouldDeliver(Receiver, C) returns true.

        If one of the tests fails, proceed to the next subscription.

      2. Build the list of delivery options with Subscription#getDeliveryOptions.

      3. For each delivery option:

        1. Fetch the delivery option's list of message formatters by calling DeliveryOption#getMessageFormatters.

        2. Find the message formatters that match the current subscription and delivery option.

        3. For each message formatter:

          1. Attempt to format the MessageContext into the DeliveryOption<M>-specific message type <M> by calling MessageFormatter#format(MessageContext<S, C>, D).

          2. If there are no valid message formatters, create a message from the subscription's default HTML or plain text format by calling Subscription#to[Html/String]Format(Receiver, Context), passing the result to the current delivery option, and calling DeliveryOption#messageFrom[Html/String](MessageContext<S, C>, String result).

          3. Take the formatted message and deliver it by calling DeliveryOption#deliverMessage(M).

          4. Capture the receiver ID, subscription ID, and any errors thrown as a DeliveryException during delivery of the message, and place into a DeliveryReference receipt for that message.

  6. Compile all delivery references for each receiver, subscription, and delivery option, along with the event message context and original publisher, into a notification object, and save it to the database.