Record Class EventExecution
java.lang.Object
java.lang.Record
com.iantapply.orchestra.domain.EventExecution
- Record Components:
id- unique execution identifierdefinitionId- source definition identifierstatus- current lifecycle statusstageIndex- zero-based current stage, or-1before startingversion- optimistic-lock versioncreatedAt- creation timeupdatedAt- last persisted update timedueAt- next time at which the engine should process this executionstageStartedAt- time at which the current stage beganvariables- immutable global variables for this executioncompletedActions- idempotency keys already persisted as completefailure- terminal failure detail, when failed
public record EventExecution(UUID id, String definitionId, EventStatus status, int stageIndex, long version, Instant createdAt, Instant updatedAt, Instant dueAt, Instant stageStartedAt, Map<String,Object> variables, Set<String> completedActions, String failure)
extends Record
Immutable, versioned runtime state for one event execution.
-
Constructor Summary
ConstructorsConstructorDescriptionEventExecution(UUID id, String definitionId, EventStatus status, int stageIndex, long version, Instant createdAt, Instant updatedAt, Instant dueAt, Instant stageStartedAt, Map<String, Object> variables, Set<String> completedActions, String failure) Snapshots mutable collections before execution state is shared. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecompletedActionsrecord component.Returns the value of thecreatedAtrecord component.Returns the value of thedefinitionIdrecord component.dueAt()Returns the value of thedueAtrecord component.final booleanIndicates whether some other object is "equal to" this one.failure()Returns the value of thefailurerecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.static EventExecutionCreates a new scheduled execution at version zero.intReturns the value of thestageIndexrecord component.Returns the value of thestageStartedAtrecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.transition(EventStatus next, int nextStage, Instant now, Instant nextDueAt) Creates the next version with a new lifecycle state.Returns the value of theupdatedAtrecord component.Returns the value of thevariablesrecord component.longversion()Returns the value of theversionrecord component.withCompletedAction(String key, Instant now) Records one action as durably completed.withFailure(String message, Instant now) Creates a failed copy of this execution.withVariables(Map<String, Object> nextVariables, Instant now) Replaces the complete variable snapshot.
-
Constructor Details
-
EventExecution
public EventExecution(UUID id, String definitionId, EventStatus status, int stageIndex, long version, Instant createdAt, Instant updatedAt, Instant dueAt, Instant stageStartedAt, Map<String, Object> variables, Set<String> completedActions, String failure) Snapshots mutable collections before execution state is shared.
-
-
Method Details
-
scheduled
Creates a new scheduled execution at version zero.- Parameters:
id- unique execution identifierdefinitionId- source definition identifiernow- creation timedueAt- requested start time- Returns:
- new scheduled execution
-
transition
Creates the next version with a new lifecycle state.- Parameters:
next- next statusnextStage- next stage indexnow- transition timenextDueAt- next processing time- Returns:
- incremented immutable execution
-
withFailure
Creates a failed copy of this execution.- Parameters:
message- failure descriptionnow- failure time- Returns:
- incremented failed execution
-
withCompletedAction
Records one action as durably completed.- Parameters:
key- completed action idempotency keynow- completion time- Returns:
- incremented execution containing the key
-
withVariables
Replaces the complete variable snapshot.- Parameters:
nextVariables- complete replacement variable mapnow- update time- Returns:
- incremented execution with an immutable variable snapshot
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
-
definitionId
Returns the value of thedefinitionIdrecord component.- Returns:
- the value of the
definitionIdrecord component
-
status
-
stageIndex
public int stageIndex()Returns the value of thestageIndexrecord component.- Returns:
- the value of the
stageIndexrecord component
-
version
-
createdAt
-
updatedAt
-
dueAt
-
stageStartedAt
Returns the value of thestageStartedAtrecord component.- Returns:
- the value of the
stageStartedAtrecord component
-
variables
-
completedActions
Returns the value of thecompletedActionsrecord component.- Returns:
- the value of the
completedActionsrecord component
-
failure
-