Class JobProgressEvent<P>
java.lang.Object
ai.redouble.nucleo.events.AbstractJobEvent
ai.redouble.nucleo.events.JobProgressEvent<P>
- Type Parameters:
P- Payload type
- All Implemented Interfaces:
ProgressEvent, HumanReadable, JobEvent, Serializable
- Direct Known Subclasses:
ContentStreamEvent
public non-sealed class JobProgressEvent<P>
extends AbstractJobEvent
implements ProgressEvent, HumanReadable
Job progress event with typed payload. Implements
HumanReadable for
direct delivery to WebSocket observers.
Automatically maps progress percentage to lifecycle MsgType:
0% is STARTING, 1-99% PROGRESSING, 100% COMPLETING, no percent STATUS_UPDATE. The title is
the job's display name and the job state is the snapshot's.
The getPayload() method is @JsonIgnore to prevent generic serialization;
subclasses expose payloads with specific names (e.g., ContentStreamEvent.chunk()).
The payload's toString() is used as the human-readable message content.
- Since:
- 0.1 (2025-09-15)
- Author:
- Andrey Santrosyan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJobProgressEvent(JobSnapshot snapshot, P payload) Creates a new update event with just data.JobProgressEvent(JobSnapshot snapshot, P payload, int progressPercent) Creates a new update event with data and progress. -
Method Summary
Modifier and TypeMethodDescriptionReturns a plain-text message suitable for display to end users.booleanHelper to check if this event has progress information.jobState()msgType()protected voidsetPayload(P payload) For the subclasses' constructors: an event is immutable once built.protected voidsetProgressPercent(Integer progressPercent) For the subclasses' constructors: an event is immutable once built.title()Methods inherited from class AbstractJobEvent
message, setMessage, snapshot, timestamp
-
Constructor Details
-
JobProgressEvent
Creates a new update event with just data. -
JobProgressEvent
Creates a new update event with data and progress.
-
-
Method Details
-
msgType
-
title
-
jobState
-
getPayload
-
setPayload
For the subclasses' constructors: an event is immutable once built. -
getProgressPercent
-
setProgressPercent
For the subclasses' constructors: an event is immutable once built. -
hasProgress
public boolean hasProgress()Helper to check if this event has progress information. -
getHumanMessage
Description copied from interface:HumanReadableReturns a plain-text message suitable for display to end users.- Specified by:
getHumanMessagein interfaceHumanReadable- Returns:
- user-friendly message
-