Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/checkr/states-language-cadence
States Language on Cadence
https://github.com/checkr/states-language-cadence
Last synced: 2 months ago
JSON representation
States Language on Cadence
- Host: GitHub
- URL: https://github.com/checkr/states-language-cadence
- Owner: checkr
- License: apache-2.0
- Created: 2019-10-08T21:46:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-06T18:20:33.000Z (about 5 years ago)
- Last Synced: 2024-08-02T05:10:40.085Z (5 months ago)
- Language: Go
- Homepage:
- Size: 13.8 MB
- Stars: 62
- Watchers: 8
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cadence-temporal-workflow - States Language on Cadence
README
# States Language on Cadence
This is an implementation of [States Language](https://states-language.net/spec.html) on top of the [Cadence Workflow](https://cadenceworkflow.io/) engine.
#### Project Status
:warning: **Note: This project is not production ready!** :warning:
This project is still under development and isn't ready for use in production. Feedback is welcome from the Cadence community. The goal is to provide a plugable way to execute State Language workflows on top of Cadence.
There a few States Language features still missing:
- [ ] Error handling
- [ ] Retry logic
- [ ] JSON paths
- [ ] Map task type#### About States Language
Amazon States Language (ASL) is a JSON specification describing state machines and workflows. It is the description that powers AWS Step Functions. Cadence is a robust workflow engine created and open sourced by Uber.
This project allows you to mimic Step Functions outside of AWS infrastructure on inside a Cadence workflow.- [Spec](./STATE_SPEC.md)
- [Website](https://states-language.net/spec.html)
- [Editor](https://github.com/checkr/states-language-editor)#### Running tests
```
make test
```#### Updating vendors
```
make mod-vendor
```#### Example
An example command is provided in `cmd/workflow`. It should demenstrate how to use the framework and register workflows.
#### Related projects
Thanks to the folks at Amazon for designing the state machine spec, the folks at Coinbase for building an [implementation in Golang](https://github.com/coinbase/step) and the folks at Uber for building [Cadence](https://github.com/uber/cadence)
---
#### What is States Language?
The operation of a state machine is specified by states, which are represented by JSON objects, fields in the top-level
`"States"` object. In this example, there is one state named `"FirstState"`.When this state machine is launched, the interpreter begins execution by identifying the Start State (`"StartAt"`). It
executes that state, and then checks to see if the state is marked as an End State. If it is, the machine terminates
and returns a result. If the state is not an End State, the interpreter looks for a `"Next"` field to determine what
state to run next; it repeats this process until it reaches a Terminal State (Succeed, Fail, or an End State) or a
runtime error occurs.![Example](example.png)
```json
{
"Comment": "An example of the Amazon States Language using a choice state.",
"StartAt": "FirstState",
"States": {
"FirstState": {
"Type": "Task",
"Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
"Next": "ChoiceState"
},
"ChoiceState": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.foo",
"NumericEquals": 1,
"Next": "FirstMatchState"
},
{
"Variable": "$.foo",
"NumericEquals": 2,
"Next": "SecondMatchState"
}
],
"Default": "DefaultState"
},
"FirstMatchState": {
"Type": "Task",
"Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:OnFirstMatch",
"Next": "NextState"
},
"SecondMatchState": {
"Type": "Task",
"Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:OnSecondMatch",
"Next": "NextState"
},
"DefaultState": {
"Type": "Fail",
"Error": "DefaultStateError",
"Cause": "No Matches!"
},
"NextState": {
"Type": "Task",
"Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
"End": true
}
}
}
```