-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (36 loc) · 1.03 KB
/
main.go
File metadata and controls
43 lines (36 loc) · 1.03 KB
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
40
41
42
43
package main
import (
"context"
"flag"
"log"
"go.temporal.io/sdk/client"
)
// @@@SNIPSTART samples-go-cancellation-cancel-workflow-execution-trigger
func main() {
var workflowID string
flag.StringVar(&workflowID, "wid", "workflowID-to-cancel", "workflowID of the Workflow Execution to be canceled.")
flag.Parse()
if workflowID == "" {
flag.PrintDefaults()
return
}
// 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()
//err = c.CancelWorkflow(context.Background(), workflowID, "")
//if err != nil {
// log.Fatalln("Unable to cancel Workflow Execution", err)
//}
log.Println("SIGNALLING")
err = c.SignalWorkflow(context.Background(), workflowID, "", "cancelme", "cancelled")
if err != nil {
log.Fatalln("Unable to signal Workflow Execution", err)
}
log.Println("Workflow Execution cancelled", "WorkflowID", workflowID)
}
// @@@SNIPEND