Class SchedulerEvent

java.lang.Object
ai.redouble.nucleo.events.SchedulerEvent
All Implemented Interfaces:
SystemEvent, JobEvent, Serializable

public final class SchedulerEvent extends Object implements SystemEvent, Serializable
System-level event for scheduler state changes: started, stopping, stopped, or an error carrying its cause. Each type has a default message a caller may replace; an error event's message names the error's own message, or "Unknown" without one. Not tied to any job, so it answers a null snapshot and reaches global and by-type subscriptions for all jobs, never a job-type-scoped or a workflow-scoped one.
Since:
0.1 (2025-10-14)
Author:
Andrey Santrosyan
See Also:
  • Constructor Details

    • SchedulerEvent

      public SchedulerEvent(SchedulerEvent.Type type)
      Creates a scheduler event with default message.
    • SchedulerEvent

      public SchedulerEvent(SchedulerEvent.Type type, String message)
      Creates a scheduler event with custom message.
    • SchedulerEvent

      public SchedulerEvent(Throwable error)
      Creates a scheduler error event.
    • SchedulerEvent

      public SchedulerEvent(SchedulerEvent.Type type, String message, Throwable error)
      Full constructor.
  • Method Details

    • getType

      public SchedulerEvent.Type getType()
    • getError

      public Throwable getError()
    • snapshot

      public JobSnapshot snapshot()
      Description copied from interface: JobEvent
      Gets the job snapshot containing all job metadata and state. This is an immutable snapshot of the job at the time the event was created.
      Specified by:
      snapshot in interface JobEvent
      Returns:
      the job snapshot
    • timestamp

      public Instant timestamp()
      Description copied from interface: JobEvent
      Gets the timestamp when this event was created.
      Specified by:
      timestamp in interface JobEvent
      Returns:
      the event creation timestamp
    • message

      public String message()
      Description copied from interface: JobEvent
      Gets the message associated with this event. May provide additional context about the state change or event.
      Specified by:
      message in interface JobEvent
      Returns:
      the event message, may be null