Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linear API for workflows #47

Open
rkuhn opened this issue May 14, 2023 · 0 comments
Open

linear API for workflows #47

rkuhn opened this issue May 14, 2023 · 0 comments

Comments

@rkuhn
Copy link
Member

rkuhn commented May 14, 2023

Inspired by conversations with Temporal we could investigate using async function* for writing machines. One idea is to await events and yield new states. Or yielding a new state (which suspends the generator until new events arrive) returns the next batch of events.

In the auction example, yielding the Auction state would resume with either a Bid or Selected event, so writing the state progression would be done using a while loop. In contrast to Rust the while condition cannot bind a new variable, so this would be less compact, but it could still make the workflow structure nicer to read than with the current Auction.react(...) API.

A completely different approach would be to offer an API for non-UI code, i.e. including also the decision-making business logic in the generator; one open question here is how to ensure that commands are only performed when the local log has been consumed in full (i.e. forcing inclusion of events coming in from other peers).

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

No branches or pull requests

1 participant