Interface TerminalEvent
- All Superinterfaces:
JobEvent, LifecycleEvent
- All Known Subinterfaces:
FailureEvent, SuccessEvent
- All Known Implementing Classes:
AbstractTerminalEvent, DependencyFailureEvent, JobCancelled, JobCompletedEvent, JobFailedEvent, JobTimedOut
public sealed interface TerminalEvent
extends LifecycleEvent
permits AbstractTerminalEvent<R>, SuccessEvent, FailureEvent
Sealed interface for events representing a job's final state.
Permitted subtypes form a closed hierarchy:
AbstractTerminalEvent(sealed base) -JobCompletedEvent,JobFailedEvent,JobTimedOut, andJobCancelled, the explicit stop that is neither success nor failureSuccessEvent(sealed) -JobCompletedEventFailureEvent(sealed) -JobFailedEvent,JobTimedOut,DependencyFailureEvent
All concrete implementations are final. User code cannot create custom terminal
events - only the platform fires these. The defaults below are what a terminal event
outside AbstractTerminalEvent answers: no responses, no metadata, timing read off
the snapshot, the event's message as the error message, "Unknown" as the error type, and
the cause taken from FailureEvent.getError() on a failure and empty otherwise.
Distinct from WorkflowTerminationEvent, which is a UI signal for
workflow-scoped observers and does not extend this interface.
- Since:
- 0.1 (2025-09-15)
- Author:
- Andrey Santrosyan
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetCause()Gets the cause if this is a failure event.default InstantGets the completion time of the job.default DurationGets the duration of the job execution.default StringGets the error message if this is a failure event.default StringGets the error type if this is a failure event.default List<LLMResponse<?>> Gets the LLM responses made during job execution.Gets the job execution metadata (wait times, costs, etc.).default InstantGets the start time of the job.
-
Method Details
-
getLlmResponses
Gets the LLM responses made during job execution.- Returns:
- list of LLM responses, may be empty but never null
-
getMetadata
-
getStartTime
Gets the start time of the job.- Returns:
- start time, or null if not started
-
getCompletionTime
-
getDuration
-
getErrorMessage
Gets the error message if this is a failure event.- Returns:
- error message
-
getErrorType
-
getCause
-