-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathmain.go
More file actions
32 lines (25 loc) · 758 Bytes
/
Copy pathmain.go
File metadata and controls
32 lines (25 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"context"
"log"
"github.com/cschleiden/go-workflows/client"
"github.com/cschleiden/go-workflows/samples"
simple_split_worker "github.com/cschleiden/go-workflows/samples/simple-split-worker"
"github.com/google/uuid"
)
func main() {
ctx := context.Background()
b := samples.GetBackend("simple-split", false)
// Start workflow via client
c := client.New(b)
startWorkflow(ctx, c)
}
func startWorkflow(ctx context.Context, c *client.Client) {
wf, err := c.CreateWorkflowInstance(ctx, client.WorkflowInstanceOptions{
InstanceID: uuid.NewString(),
}, simple_split_worker.Workflow1, "Hello world "+uuid.NewString())
if err != nil {
panic("could not start workflow")
}
log.Println("Started workflow", wf.InstanceID)
}