User notifications
Atoti Limits uses the Notification Service to send notifications to the UI. Out of the box, Atoti Limits sends notifications:- to users with the role
ROLE_ADMINwhen the initial data load completes. This is configurable in theapplication.ymlfile using thelimits.notification.server-started-notification-user-roleproperty. - to all users when limit evaluations complete. This is configurable in the
application.ymlfile using thelimits.notification.evaluation-completed-notification-user-roleproperty. - to users specified as
Approverswhen a FourEyes limit is created or updated
Technical notifications
Atoti Limits also sends technical notifications, which the UI uses internally and does not show to users. For example, when Limits KPIs are updated, the UI refreshes the affected data models automatically.Send a custom notification
To send custom notifications, follow these steps.1. Inject the INotificationService bean into your class
The INotificationService is responsible for all management of notifications, including publishing, retrieving, and
executing actions. To use it, inject the service into the component that needs to send notifications:
2. Create and publish your notifications
With the service wired up, you can now create and publish notifications. TheNotification class is a simple POJO that represents a notification.
Use one of the class’s builder methods to create Notification objects:
Notification.notificationWithDefaultActionsBuilder(): Creates a notification with the default actions. For more information see the actions section. This is the recommended builder to use in most scenarios.Notification.builder(): Creates a bare notification with no actions.
INotificationService:
Notification actions
Notifications can have actions that users can take when they receive them. Instances of theNotificationAction class
represent one of these actions that can be taken on a notification. There are three default actions that are provided
when using the Notification.notificationWithDefaultActionsBuilder() method:
MARK_READ: Marks the notification as read. Only enabled if the notification is unread (isRead=false).MARK_UNREAD: Marks the notification as unread. Only enabled if the notification is read (isRead=true).DELETE: Deletes the notification.
Restrict notifications to specific users
By default, notifications are sent to all users. If you want to restrict a notification to only be sent to specific users, you can do so by setting theusers or userRoles fields:
users list AND have one of the roles in userRoles.
Notification Service properties
The Notification Service contains the following properties that can be configured in yourapplication.yml file:
| Property | Default Value | Description |
|---|---|---|
notification-service.emitter-timeout | 8h | The maximum time to keep the connection to the UI open. |
notification-service.initial-notification-mode | SEND_ALL | Controls the notifications that are sent in the initial event after a subscription is created. Available modes:
|