Class Timer
java.lang.Object
io.superdurable.dex.Timer
Creates server-side durable timer conditions for Step waits.
This is not a JVM timer and does not require the Worker process to remain running. Dex stores
the timer as part of the durable Flow execution on the server, so the deadline remains scheduled
across Worker disconnections, process restarts, and machine failures. No Java thread is blocked
while the timer is pending. When the server-side timer fires and the surrounding Wait is
satisfied, Dex invokes the Step through an available Worker. Add a stable condition ID when
application code needs to inspect or skip a specific timer later.
public Wait waitFor(Context context, Order input) {
return Wait.until(Timer.byDuration(Duration.ofMinutes(10), "payment-timeout"));
}
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConditionbyDuration(Duration duration) Creates a server-side durable timer condition without a condition ID.static ConditionbyDuration(Duration duration, String conditionId) Creates a server-side durable timer condition with a stable condition ID.
-
Method Details
-
byDuration
Creates a server-side durable timer condition without a condition ID.- Parameters:
duration- the nonnegative delay before the timer fires- Returns:
- the timer condition
- Throws:
IllegalArgumentException- ifdurationisnullor negative
-
byDuration
Creates a server-side durable timer condition with a stable condition ID.- Parameters:
duration- the nonnegative delay before the timer firesconditionId- the ID used to inspect or skip this timer- Returns:
- the timer condition
- Throws:
IllegalArgumentException- ifdurationisnullor negative
-