Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pancsta committed Jan 12, 2024
1 parent 4cd5922 commit 6c8f50b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
# asyncmachine-go

`asyncmachine-go` is a minimal implementation of [AsyncMachine](https://github.com/TobiaszCudnik/asyncmachine) in
Golang using _channels_ and _context_. It aims at simplicity and speed.
Golang using **channels and context**. It aims at simplicity and speed.

It can be used as a lightweight in-memory [Temporal](https://github.com/temporalio/temporal) alternative, worker for
[Asynq](https://github.com/hibiken/asynq), or to write simple consensus engines, stateful firewalls, telemetry, bots,
etc.

AsyncMachine is a relational state machine which never blocks.

```go
package main

import (
"context"
"fmt"

am "github.com/pancsta/asyncmachine-go/pkg/machine"
)

func main() {
ctx := context.Background()
m := am.New(ctx, am.States{
"Foo": {
Add: am.S{"Bar"}
},
"Bar": {},
}, nil)
m.Add(am.S{"Foo"}, nil)
fmt.Printf("%s", m) // (Foo:1 Bar:1)
}
```

## Examples

- [Expense Workflow](/examples/temporal-expense/expense_test.go) \|
Expand Down

0 comments on commit 6c8f50b

Please sign in to comment.