Interface Flow<StartInput>
- Type Parameters:
StartInput- the Java input type accepted by the Flow's start Step
Applications implement this interface on a concrete class and register an instance with
Registry. The generic parameter is the input accepted by the start Step; the typed
StepList.startStep(Step) factory enforces that relationship at compile time. A Flow may omit a
start Step and begin only through an RPC. The default Flow type is the concrete class's simple
name, so explicit named classes make that type predictable and reviewable.
final class OrderFlow implements Flow<OrderInput> {
private final ValidateOrder start = new ValidateOrder();
private final ChargeOrder charge = new ChargeOrder();
@Override
public StepList<OrderInput> getSteps() {
return StepList.startStep(start).otherSteps(charge);
}
}
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringReturns the Flow type used to register and start this Flow.default PersistenceSchemaReturns the persistent Attributes and Channels used by this Flow.default StepList<StartInput> getSteps()Returns the Flow's start Step and all other registered Steps.default StepDecisionhandleTimeout(Context context) Handles expiration of this Flow's soft timeout.
-
Method Details
-
getFlowType
Returns the Flow type used to register and start this Flow.The default is
getClass().getSimpleName(). Override it when refactoring the Java class name must not change the Flow type stored by Dex.- Returns:
- the nonblank Flow type
-
getSteps
Returns the Flow's start Step and all other registered Steps.The default is an empty list, which is valid for an RPC-only Flow. Every Step targeted by a decision or RPC result must appear in this list.
- Returns:
- the immutable typed Step list; never
null
-
getPersistenceSchema
Returns the persistent Attributes and Channels used by this Flow.The default schema is empty. Every persistence definition used by Steps or RPC methods must be registered here.
- Returns:
- the Flow's immutable persistence schema; never
null
-
handleTimeout
Handles expiration of this Flow's soft timeout.Override this method to make a positive timeout default to
FlowTimeoutPolicy.HANDLER. Dex starts one logical execution after the durable timeout timer completes or is skipped; configured retry attempts may invoke it more than once. The returned decision may transition to another Step, end without closing, complete, fail, or request graceful completion. The Context belongs to this invocation and must not be retained.- Parameters:
context- the timeout-handler invocation Context- Returns:
- the non-null decision applied with normal Step Execute semantics
- Throws:
UnsupportedOperationException- when called without an application override
-