Interface Step<I>
- Type Parameters:
I- the concrete Java input type accepted by this Step
waitFor(Context, I) is optional. When a Step does not override it, Dex skips the waiting phase
and invokes execute(Context, I) immediately. When a Step implements waitFor, Dex invokes
execute after the declared durable conditions are satisfied. Both methods are synchronous
Java calls executed by the worker's bounded executor. A Step instance is shared across
invocations, so keep per-execution state in Context, Attributes, or method-local
variables rather than mutable instance fields.
final class ChargeOrder implements Step<OrderInput> {
@Override
public Class<OrderInput> getInputType() {
return OrderInput.class;
}
@Override
public Wait waitFor(Context context, OrderInput input) {
return Wait.until(payment.forOne());
}
@Override
public StepDecision execute(Context context, OrderInput input) {
return StepDecision.gracefulComplete(input.orderId);
}
}
-
Method Summary
Modifier and TypeMethodDescriptionExecutes the Step's application logic and returns its durable decision.Returns the concrete class used to decode this Step's input.default StepOptionsReturns retry, timeout, durability, locking, and failure behavior for this Step.default StringReturns the Step type used to register this Step.default WaitDeclares the conditions that must be satisfied before execution.
-
Method Details
-
getInputType
Returns the concrete class used to decode this Step's input.The class must agree with
I. A parameterized input such asList<Order>cannot be returned becauseList.classdoes not retain its element type. Wrap the list in a concrete input class and return that wrapper's class, or useOrder[].classwhen an array fits the input model.- Returns:
- the concrete, nonnull Step input class
-
execute
Executes the Step's application logic and returns its durable decision.- Parameters:
context- the invocation-scoped Flow contextinput- the decoded Step input, which may benullforVoidSteps- Returns:
- the nonnull decision describing the next durable action
-
waitFor
Declares the conditions that must be satisfied before execution.When this method is not overridden, the registry marks the Step to skip wait-for invocation and execute immediately. An override may also return
Wait.skipImmediately()explicitly.- Parameters:
context- the invocation-scoped Flow contextinput- the decoded Step input- Returns:
- the nonnull durable wait definition
-
getStepType
Returns the Step type used to register this Step.The default is
getClass().getSimpleName(). Use an explicit named class or override this method so refactoring does not accidentally change the Step type stored by Dex.- Returns:
- the nonblank Step type
-
getStepOptions
Returns retry, timeout, durability, locking, and failure behavior for this Step.- Returns:
- Step-specific options, or
nullto use all defaults
-