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 Details

    • JobProgressEvent

      public JobProgressEvent(JobSnapshot snapshot, P payload)
      Creates a new update event with just data.
    • JobProgressEvent

      public JobProgressEvent(JobSnapshot snapshot, P payload, int progressPercent)
      Creates a new update event with data and progress.
  • Method Details

    • msgType

      public MsgType msgType()
    • title

      public String title()
    • jobState

      public JobState jobState()
    • getPayload

      public P getPayload()
    • setPayload

      protected void setPayload(P payload)
      For the subclasses' constructors: an event is immutable once built.
    • getProgressPercent

      public Integer getProgressPercent()
    • setProgressPercent

      protected void setProgressPercent(Integer progressPercent)
      For the subclasses' constructors: an event is immutable once built.
    • hasProgress

      public boolean hasProgress()
      Helper to check if this event has progress information.
    • getHumanMessage

      public String getHumanMessage()
      Description copied from interface: HumanReadable
      Returns a plain-text message suitable for display to end users.
      Specified by:
      getHumanMessage in interface HumanReadable
      Returns:
      user-friendly message