Package su.onno.ui.notifications
Class NotificationService
java.lang.Object
su.onno.ui.notifications.NotificationService
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:
- Local — an app or a built-in producer calls
notify(su.onno.ui.notifications.NotificationRequest); the row is stored, pushed to this node's recipient streams, and broadcast to peers. - Remote — a peer relayed a
ClusterEvent.Notification(onRemote(su.onno.cluster.ClusterEvent.Notification)); the durable copy already exists in the shared table, so the event only wakes this node's recipient streams and is never re-stored or re-broadcast (no relay loop).
A daily sweep prunes read notifications older than NotificationProperties.getRetentionDays();
unread ones are kept indefinitely.
-
Constructor Summary
ConstructorsConstructorDescriptionNotificationService(NotificationStore store, UiEventPublisher publisher, ClusterEventBus bus, NotificationProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionintmarkAllRead(String recipientId) booleanRaise a notification: persist it, push it to the recipient's live streams here, and relay it to peer nodes.voidA peer node raised a notification whose recipient may be connected here — wake their streams only.voidstart()voidstop()The distinct notification types this recipient has — drives the panel's modular filter tabs.intunreadCount(String recipientId)
-
Constructor Details
-
NotificationService
public NotificationService(NotificationStore store, UiEventPublisher publisher, ClusterEventBus bus, NotificationProperties properties)
-
-
Method Details
-
start
@PostConstruct public void start() -
stop
@PreDestroy public void stop() -
notify
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, ornullwhen the request was not deliverable. -
onRemote
A peer node raised a notification whose recipient may be connected here — wake their streams only. -
list
-
unreadCount
-
types
The distinct notification types this recipient has — drives the panel's modular filter tabs. -
markRead
-
markAllRead
-