Enum Class StepDurability
- All Implemented Interfaces:
Serializable, Comparable<StepDurability>, Constable
ASYNC lets Dex continue the Flow without first waiting for the completed method result
to be persisted. This lowers latency between Steps and makes single Flows faster. Sustained
throughput is about the same as SYNC. The tradeoff is a small failure window: if the result
has not yet been persisted when the Server fails, Dex may not see
that completion during recovery and may invoke the already-completed Step method again. Step
methods must therefore be idempotent regardless of the selected durability.
SYNC waits for the method result to be durably recorded before Dex advances based on
that result. It adds persistence latency and prevents the same degree of server-side batching, but
it closes the asynchronous result-loss window. It does not provide exactly-once execution, so Step
methods must still be safe to retry.
The server default for Step methods is SYNC. Use
FlowConfig.Builder.stepDurability to override the default for a Flow. Use
StepOptions.Builder.waitForDurability or
StepOptions.Builder.executeDurability to override one method on a specific Step; these
method-level choices take precedence over the Flow configuration.
Wait-for and execute failure policies do not change this precedence. A Flow-wide asynchronous default therefore applies to methods with failure policies unless the Step method overrides it.
FlowConfig fastByDefault = FlowConfig.newBuilder()
.stepDurability(StepDurability.ASYNC)
.build();
public StepOptions getStepOptions() {
return StepOptions.newBuilder()
.waitForFailure(WaitForFailurePolicy.PROCEED)
.waitForDurability(StepDurability.SYNC)
.executeDurability(StepDurability.SYNC)
.onExecuteFailureProceedTo(recoveryStep)
.build();
}
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic StepDurabilityReturns the enum constant of this class with the specified name.static StepDurability[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DEFAULT
Uses the applicable Flow configuration or the synchronous server default.A method-level DEFAULT defers to
FlowConfig. Without a Flow override, it resolves toSYNC. Failure policies do not change the result. -
SYNC
Persists the method result before Dex advances based on it.This adds persistence latency and reduces batching opportunities, but prevents a completed result from being lost solely because Dex advanced before recording it. Retries can still occur, so this mode does not remove the idempotency requirement.
-
ASYNC
Allows Dex to advance before the completed method result is durably recorded.This lowers latency and makes single Flows faster, with about the same sustained throughput, while accepting that an extreme failure may lose an unpersisted result and cause the Step method to execute again.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-