Skip to content

Add promise-based workflow await - #3055

Open
baekgyu-kim wants to merge 1 commit into
temporalio:mainfrom
baekgyu-kim:1937
Open

Add promise-based workflow await#3055
baekgyu-kim wants to merge 1 commit into
temporalio:mainfrom
baekgyu-kim:1937

Conversation

@baekgyu-kim

Copy link
Copy Markdown
Contributor

What was changed

  • Added Async.await(Duration, Supplier<Boolean>), a non-blocking, promise-based version of Workflow.await.
  • Runs the existing Workflow.await on a separate workflow thread. The promise completes with true when the condition is met, false on timeout, or exceptionally on cancellation or a predicate exception.
  • Added tests for completion, timeout, cancellation, predicate exceptions, non-blocking behavior, and composition with an activity promise.

Why?

Workflow.await blocks the current workflow thread, so its result cannot be combined with other promises. This API allows workflows to use an await condition with Promise.allOf, for example when waiting for both a signal and an activity.

Checklist

  1. Closes Support a promise-based await #1937

  2. How was this tested:

    ./gradlew :temporal-sdk:test --offline \
      --tests io.temporal.workflow.AsyncAwaitTest \
      --tests io.temporal.workflow.AwaitTest \
      --tests io.temporal.workflow.cancellationTests.WorkflowAwaitCancelTimerOnConditionTest
  3. Any docs updates needed?

    No. The new API is documented with Javadocs.

@baekgyu-kim
baekgyu-kim requested a review from a team as a code owner September 3, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support a promise-based await

1 participant