Class Wait
Return a Wait from Step.waitFor(Context, I). The value is declarative and immutable: Dex
persists and evaluates its Timer, Channel, and SubFlow conditions without blocking the worker
thread that produced it. Use until(Condition) for a single condition, allOf(Condition...) or
anyOf(Condition...) for a flat group, and anyCombinationOf(ConditionCombination...) for alternatives containing
multiple conditions.
public Wait waitFor(Context context, Order input) {
return Wait.anyOf(
paymentReceived.forOne(),
Timer.byDuration(Duration.ofHours(1)));
}
-
Method Summary
Modifier and TypeMethodDescriptionstatic WaitWaits until every supplied condition is satisfied.static WaitanyCombinationOf(ConditionCombination... combinations) Waits until every condition in any one supplied combination is satisfied.static WaitWaits until any supplied condition is satisfied.static WaitSkips condition evaluation and makes the Step immediately eligible to execute.static WaitWaits for one condition to be satisfied.
-
Method Details
-
skipImmediately
Skips condition evaluation and makes the Step immediately eligible to execute.- Returns:
- an immediate wait definition
-
until
-
allOf
Waits until every supplied condition is satisfied.This combinator does not require condition IDs. Every Condition in
anyCombinationOf(ConditionCombination...)does require one.- Parameters:
conditions- the conditions that must all be satisfied- Returns:
- an all-of wait definition
-
anyOf
Waits until any supplied condition is satisfied.Conditions do not need condition IDs. Read Channel results from the Channel definition and inspect Timer outcomes through
Context.Among ready conditions, Dex selects the first in canonical order: Timers, Channels, then SubFlows, preserving argument order within each kind. An unready condition does not block a later ready condition. To wait for strict priority, return only the higher-priority condition.
Channel consumption is not greedy across alternatives. Dex consumes messages only from the selected Channel condition; other ready Channel conditions consume nothing.
- Parameters:
conditions- the alternative conditions- Returns:
- an any-of wait definition
-
anyCombinationOf
Waits until every condition in any one supplied combination is satisfied.Channel consumption is not greedy across combinations. Dex consumes messages only from Channel conditions in the selected combination. Conditions belonging only to other ready combinations consume nothing.
Every Condition must have a non-empty user-provided ID. Reusing the same Condition object across combinations is supported; distinct Conditions must not share an ID.
- Parameters:
combinations- alternative all-of condition groups- Returns:
- an any-combination wait definition
- Throws:
InvalidStepResultException- when a Condition ID is missing, empty, or duplicated
-