Actyx / Actyx/machines

linear API for workflows

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Inspired by conversations with [Temporal](https://typescript.temporal.io/api/namespaces/workflow) 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).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the current Auction.react(...) API and the auction example described in the issue, then compare that workflow structure with TypeScript async generators and the linked Temporal workflow API. A useful outcome would define which generator model to pursue and how event consumption and command execution should behave, but the issue leaves those design decisions open.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.