Class NotificationService

java.lang.Object
su.onno.ui.notifications.NotificationService

public class NotificationService extends Object
The framework's notification hub and public producer API. It persists a notification to the shared NotificationStore, pushes it to the recipient's live SSE streams on this node, and relays it over the ClusterEventBus so streams the recipient holds on peer nodes light up too.

Two inputs feed the same delivery, mirroring PresenceRegistry:

A daily sweep prunes read notifications older than NotificationProperties.getRetentionDays(); unread ones are kept indefinitely.

  • Constructor Details

  • Method Details

    • start

      @PostConstruct public void start()
    • stop

      @PreDestroy public void stop()
    • notify

      public Notification notify(NotificationRequest req)
      Raise a notification: persist it, push it to the recipient's live streams here, and relay it to peer nodes. A request with no recipient or no title is a silent no-op, so producers need not guard. Returns the stored notification, or null when the request was not deliverable.
    • onRemote

      public void onRemote(ClusterEvent.Notification event)
      A peer node raised a notification whose recipient may be connected here — wake their streams only.
    • list

      public NotificationStore.Page list(String recipientId, boolean unreadOnly, String cursor)
    • unreadCount

      public int unreadCount(String recipientId)
    • types

      public List<String> types(String recipientId)
      The distinct notification types this recipient has — drives the panel's modular filter tabs.
    • markRead

      public boolean markRead(UUID id, String recipientId)
    • markAllRead

      public int markAllRead(String recipientId)