- Notifications
You must be signed in to change notification settings - Fork47
Go SDK for Serverless Workflow
License
serverlessworkflow/sdk-go
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The Go SDK for Serverless Workflow provides strongly-typed structures for theServerless Workflow specification. It simplifies parsing, validating, and interacting with workflows in Go. Starting from versionv3.1.0
, the SDK also includes a partial reference implementation, allowing users to execute workflows directly within their Go applications.
This table indicates the current state of implementation of various SDK features:
Feature | Status |
---|---|
Parse workflow JSON and YAML definitions | ✔️ |
Programmatically build workflow definitions | ✔️ |
Validate workflow definitions (Schema) | ✔️ |
Specification Implementation | ✔️* |
Validate workflow definitions (Integrity) | 🚫 |
Generate workflow diagram (SVG) | 🚫 |
Note: *Implementation is partial; contributions are encouraged.
Latest Releases | Conformance to Spec Version |
---|---|
v1.0.0 | v0.5 |
v2.0.1 | v0.6 |
v2.1.2 | v0.7 |
v2.5.0 | v0.8 |
v3.1.0 | v1.0.0 |
The SDK provides a partial reference runner to execute your workflows:
Below is a simple YAML workflow that sets a message and then prints it:
document:dsl:"1.0.0"namespace:"examples"name:"simple-workflow"version:"1.0.0"do: -set:message:"Hello from the Serverless Workflow SDK in Go!"
You can execute this workflow using the following Go program:
Example of executing a workflow defined in YAML:
package mainimport ("fmt""os""path/filepath""github.com/serverlessworkflow/sdk-go/v3/impl""github.com/serverlessworkflow/sdk-go/v3/parser")funcRunWorkflow(workflowFilePathstring,inputmap[string]interface{}) (interface{},error) {data,err:=os.ReadFile(filepath.Clean(workflowFilePath))iferr!=nil {returnnil,err }workflow,err:=parser.FromYAMLSource(data)iferr!=nil {returnnil,err }runner:=impl.NewDefaultRunner(workflow)output,err:=runner.Run(input)iferr!=nil {returnnil,err }returnoutput,nil}funcmain() {output,err:=RunWorkflow("./myworkflow.yaml",map[string]interface{}{"shouldCall":true})iferr!=nil {panic(err) }fmt.Printf("Workflow completed with output: %v\n",output)}
The table below lists the current state of this implementation. This table is a roadmap for the project based on theDSL Reference doc.
Feature | State |
---|---|
Workflow Document | ✅ |
Workflow Use | 🟡 |
Workflow Schedule | ❌ |
Task Call | ❌ |
Task Do | ✅ |
Task Emit | ❌ |
Task For | ✅ |
Task Fork | ✅ |
Task Listen | ❌ |
Task Raise | ✅ |
Task Run | ❌ |
Task Set | ✅ |
Task Switch | ✅ |
Task Try | ❌ |
Task Wait | ❌ |
Lifecycle Events | 🟡 |
External Resource | ❌ |
Authentication | ❌ |
Catalog | ❌ |
Extension | ❌ |
Error | ✅ |
Event Consumption Strategies | ❌ |
Retry | ❌ |
Input | ✅ |
Output | ✅ |
Export | ✅ |
Timeout | ❌ |
Duration | ❌ |
Endpoint | ✅ |
HTTP Response | ❌ |
HTTP Request | ❌ |
URI Template | ✅ |
Container Lifetime | ❌ |
Process Result | ❌ |
AsyncAPI Server | ❌ |
AsyncAPI Outbound Message | ❌ |
AsyncAPI Subscription | ❌ |
Workflow Definition Reference | ✅ |
Subscription Iterator | ❌ |
We love contributions! Our aim is to have a complete implementation to serve as a reference or to become a project on its own to favor the CNCF Ecosystem.
If you are willing to help, pleasefile a sub-task in this EPIC describing what you are planning to work on first.
Join our community on the CNCF Slack to collaborate, ask questions, and contribute:
Find us in the#serverless-workflow-sdk
channel.
Your contributions are very welcome!
- Format imports with
goimports
. - Run static analysis using:
make lint
Automatically fix lint issues:
make lint params=--fix
A sample.editorconfig
for IntelliJ or GoLand users can be foundhere.
- MacOS Issue: If you encounter
goimports: can't extract issues from gofmt diff output
, resolve it with:
brew install diffutils
Contributions are greatly appreciated! Checkthis EPIC and contribute to completing more features.
Happy coding!
About
Go SDK for Serverless Workflow
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.