Class PrimitiveCommands
java.lang.Object
io.axoniq.framework.workflow.runtime.api.execution.context.PrimitiveCommands
Commands helper.
- Since:
- 5.4.0
- Author:
- Simon Zambrovski
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDefault publish command implementation.static final recordDefault version command implementation.static final recordDefault execute command implementation.static final recordDefault payload modification command implementation allowing asynchronous execution and returning the.invalid reference
WorkflowStepResultstatic final recordDefault wait-for-event command implementation allowing asynchronous execution and returning the.invalid reference
WorkflowStepResult -
Method Summary
Modifier and TypeMethodDescriptioncancelStep(String stepName, @Nullable Throwable cause, EventNameCustomizer eventNameCustomizer) Creates a command cancelling one running step.cancelWorkflow(@Nullable Throwable cause, EventNameCustomizer eventNameCustomizer) Creates a command cancelling an entire workflow.failWorkflow(@Nullable Throwable cause, EventNameCustomizer eventNameCustomizer) Creates a command failing an entire workflow.modifyPayload(String stepName, PayloadModification payloadModification, EventNameCustomizer eventNameCustomizer) Factory method to create aPrimitiveCommands.WorkflowStepResultModifyPayloadCommand.publish(String stepName, EventMessage event) Factory method to create aPrimitiveCommands.SimplePublishCommand, the parameter object ofPublishPrimitive.publish(PublishPrimitive.PublishCommand).version(String stepName, String newVersion, EventNameCustomizer eventNameCustomizer) Factory method to create aPrimitiveCommands.SimpleVersionCommand.waitForEvent(String stepName, EventCondition eventCondition, PayloadReducer resultPayloadReducer, Duration duration, EventNameCustomizer eventNameCustomizer) Factory method to create aPrimitiveCommands.WorkflowStepResultWaitForCommand.
-
Method Details
-
waitForEvent
public static PrimitiveCommands.WorkflowStepResultWaitForCommand waitForEvent(String stepName, EventCondition eventCondition, PayloadReducer resultPayloadReducer, Duration duration, EventNameCustomizer eventNameCustomizer) Factory method to create aPrimitiveCommands.WorkflowStepResultWaitForCommand.- Parameters:
stepName- step nameeventCondition- event conditionresultPayloadReducer- result payload reducerduration- timeout durationeventNameCustomizer- event name customizer- Returns:
- command object
-
modifyPayload
public static PrimitiveCommands.WorkflowStepResultModifyPayloadCommand modifyPayload(String stepName, PayloadModification payloadModification, EventNameCustomizer eventNameCustomizer) Factory method to create aPrimitiveCommands.WorkflowStepResultModifyPayloadCommand.- Parameters:
stepName- step namepayloadModification- payload modificationeventNameCustomizer- event name customizer- Returns:
- command object
-
version
public static PrimitiveCommands.SimpleVersionCommand version(String stepName, String newVersion, EventNameCustomizer eventNameCustomizer) Factory method to create aPrimitiveCommands.SimpleVersionCommand.- Parameters:
stepName- logical step name (developer-chosen identifier describing the change).newVersion- new workflow version to record (semver string).eventNameCustomizer- event name customizer.- Returns:
- command object.
-
publish
Factory method to create aPrimitiveCommands.SimplePublishCommand, the parameter object ofPublishPrimitive.publish(PublishPrimitive.PublishCommand).The command carries the
stepNameunder which the step is recorded in the workflow state, and theEventMessageto publish. The primitive appends that event once, enriched with workflow metadata, and skips the append on replay when the step is already recorded.- Parameters:
stepName- logical step name recorded with the published eventevent- event to publish- Returns:
- command object
-
cancelWorkflow
public static WorkflowLifecycleControl.CancelWorkflowCommand cancelWorkflow(@Nullable Throwable cause, EventNameCustomizer eventNameCustomizer) Creates a command cancelling an entire workflow.- Parameters:
cause- optional cancellation causeeventNameCustomizer- customizer for published event names- Returns:
- workflow cancellation command
-
failWorkflow
public static WorkflowLifecycleControl.FailWorkflowCommand failWorkflow(@Nullable Throwable cause, EventNameCustomizer eventNameCustomizer) Creates a command failing an entire workflow.- Parameters:
cause- optional failure causeeventNameCustomizer- customizer for published event names- Returns:
- workflow failure command
-
cancelStep
public static WorkflowLifecycleControl.CancelStepCommand cancelStep(String stepName, @Nullable Throwable cause, EventNameCustomizer eventNameCustomizer) Creates a command cancelling one running step.- Parameters:
stepName- logical name of the stepcause- optional cancellation causeeventNameCustomizer- customizer for published event names- Returns:
- step cancellation command
-