Skip to content

Support a promise-based await #1937

Description

@ghaskins

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions