Class UserNotificationEvent
java.lang.Object
ai.redouble.nucleo.events.AbstractJobEvent
ai.redouble.nucleo.events.UserNotificationEvent
- All Implemented Interfaces:
NotificationEvent, HumanReadable, JobEvent, Serializable
public final class UserNotificationEvent
extends AbstractJobEvent
implements NotificationEvent, HumanReadable
An event for important notifications that require user attention.
Unlike progress events, these are discrete messages about significant
occurrences during job execution. The severity maps to a
MsgType: an error is
ERROR, a success COMPLETING, a warning or an info MESSAGE. The four
factories read the job state off the snapshot and carry no structured details.
Examples of when to use UserNotificationEvent:
- "Found potential duplicate records - review recommended"
- "External service is slow, this may take longer than usual"
- "Successfully validated all 500 records"
- "Skipping 3 files due to unsupported format"
- Since:
- 0.1 (2025-10-11)
- Author:
- Andrey Santrosyan
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSeverity levels for notifications. -
Constructor Summary
ConstructorsConstructorDescriptionUserNotificationEvent(JobSnapshot snapshot, String title, String notification, UserNotificationEvent.Severity severity, JobState jobState) Creates a user notification event without details.UserNotificationEvent(JobSnapshot snapshot, String title, String notification, UserNotificationEvent.Severity severity, JobState jobState, Object details) Creates a user notification event. -
Method Summary
Modifier and TypeMethodDescriptionstatic UserNotificationEventerror(JobSnapshot snapshot, String title, String message) Convenience factory for error notifications.Returns a plain-text message suitable for display to end users.static UserNotificationEventinfo(JobSnapshot snapshot, String title, String message) Convenience factory for info notifications.jobState()msgType()static UserNotificationEventsuccess(JobSnapshot snapshot, String title, String message) Convenience factory for success notifications.title()static UserNotificationEventwarning(JobSnapshot snapshot, String title, String message) Convenience factory for warning notifications.Methods inherited from class AbstractJobEvent
message, setMessage, snapshot, timestamp
-
Constructor Details
-
UserNotificationEvent
public UserNotificationEvent(JobSnapshot snapshot, String title, String notification, UserNotificationEvent.Severity severity, JobState jobState, Object details) Creates a user notification event.- Parameters:
snapshot- the job snapshottitle- short title for the notificationnotification- the full notification messageseverity- the severity leveljobState- the current job lifecycle statedetails- optional structured details (can be null)
-
UserNotificationEvent
public UserNotificationEvent(JobSnapshot snapshot, String title, String notification, UserNotificationEvent.Severity severity, JobState jobState) Creates a user notification event without details.- Parameters:
snapshot- the job snapshottitle- short title for the notificationnotification- the full notification messageseverity- the severity leveljobState- the current job lifecycle state
-
-
Method Details
-
info
Convenience factory for info notifications. -
success
Convenience factory for success notifications. -
warning
Convenience factory for warning notifications. -
error
Convenience factory for error notifications. -
msgType
-
title
-
jobState
-
getHumanMessage
Description copied from interface:HumanReadableReturns a plain-text message suitable for display to end users.- Specified by:
getHumanMessagein interfaceHumanReadable- Returns:
- user-friendly message
-
getSeverity
-
getDetails
-