Wrokflow.await behavior

Does something like this work? My test is not successful

Workflow.await { startTime <= Instant.now() } and release if start time is after the current date.

If not how do we go about waiting until start time is met?


It doesn’t work. The reason is that condition is evaluated based on some other event that caused workflow to make some progress. And time-based conditions do not create timers automatically.

In your case a simple Workflow.sleep would work fine. If you need to wait for some condition up to some time use Workflow.await that takes a timeout as the first argument.


boolean matched = Worklfow.await(timeout, ()->someBooleanFlag);
if (!matched) {
   System.out.println("Await timed out");
} else {
  System.out.println("someBooleanFlag is true");
1 Like

Ok thanks @maxim. I will use Workflow.sleep. was just curious

1 Like