⚠️ This repository is abandoned.
This Zenaton library for Go lets you code and launch workflows using Zenaton platform. You can sign up for an account at https://zenaton.com
DISCLAIMER The go library is currently in public alpha. Please open an issue if you find any bugs.
This library has been tested with Go 1.10 and later.
Execute:
$ go get github.com/zenaton/zenaton-go/...
For more detailed examples, please check Zenaton go examples.
You will need to export three environment variables: ZENATON_APP_ID
, ZENATON_API_TOKEN
, ZENATON_APP_ENV
. You"ll find them here.
Then you can initialize your Zenaton client:
import(
"os"
"github.com/zenaton/zenaton-go/v1/zenaton"
)
appID = os.Getenv["ZENATON_APP_ID"]
apiToken = os.Getenv["ZENATON_API_TOKEN"]
appEnv = os.Getenv["ZENATON_APP_ENV"]
zenaton.InitClient(appID, apiToken, appEnv)
Writing a workflow is as simple as:
import "github.com/zenaton/zenaton-go/v1/zenaton/workflow"
var MyWorkflow = workflow.New("MyWorkflow",
func() (interface{}, error) {
// Your workflow Implementation
})
Note that your workflow implementation should be idempotent. See documentation.
Writing a task is as simple as:
import "github.com/zenaton/zenaton-go/v1/zenaton/task"
var MyTask = task.New("MyTask",
func() (interface{}, error) {
// Your task Implementation
})
Once your Zenaton client is initialized, you can start a workflow with
MyWorkflow.New().Dispatch()
Your workflow's tasks will be executed on your worker servers. Please install a Zenaton worker on it:
$ curl https://install.zenaton.com | sh
that you can start and configure with
$ zenaton listen --boot=path/to/boot.go
where boot.go
is a file that will be included before each task execution - this file should import all workflows. See example boot.go.
Please see https://zenaton.com/documentation for complete documentation.
To run tests, you can use go -v ./...
Bug reports and pull requests are welcome on GitHub at https://github.com/zenaton/zenaton-go. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The library is available as open source under the terms of the MIT License.