forked from temporalio/samples-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (33 loc) · 1 KB
/
main.go
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
33
34
35
36
37
38
39
package main
import (
"context"
"log"
"github.com/pborman/uuid"
"go.temporal.io/sdk/client"
"github.com/temporalio/samples-go/searchattributes"
)
func main() {
// The client is a heavyweight object that should be created once per process.
c, err := client.Dial(client.Options{
HostPort: client.DefaultHostPort,
})
if err != nil {
log.Fatalln("Unable to create client", err)
}
defer c.Close()
workflowOptions := client.StartWorkflowOptions{
ID: "search_attributes_" + uuid.New(),
TaskQueue: "search-attributes",
SearchAttributes: map[string]interface{}{ // optional search attributes when start workflow
"CustomIntField": 1,
},
Memo: map[string]interface{}{
"description": "Test search attributes workflow",
},
}
we, err := c.ExecuteWorkflow(context.Background(), workflowOptions, searchattributes.SearchAttributesWorkflow)
if err != nil {
log.Fatalln("Unable to execute workflow", err)
}
log.Println("Started workflow", "WorkflowID", we.GetID(), "RunID", we.GetRunID())
}