temporalio / temporalio/sdk-java

Support a promise-based await

Open
#1,937 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

An SDK function that works similarly to await but is based on promises rather than blocking could be useful to expand developer options for coordinating mixed event classes. For instance, coordinating an .all() on an invoked activity and receiving a signal.

This interface could be designed in several different ways. As an example:

Promise until(java.time.Duration timeout, java.util.function.Supplier<java.lang.Boolean> predicate)

This function would take a timeout and predicate, and return a promise. Temporal will evaluate the predicate on each state transition (similar to .await), and will resolve the promise with "true" if the predicate returns true. and "false" if the timeout expires.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing Workflow.await API with Promise and the proposed Promise<java.lang.Boolean> interface using java.time.Duration and java.util.function.Supplier<java.lang.Boolean>. Clarify the intended API design and state-transition behavior, including coordination with activity promises and signals. Done means the chosen interface resolves true when the predicate becomes true and false when the timeout expires.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.