forked from temporalio/samples-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
31 lines (26 loc) · 835 Bytes
/
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
package main
import (
"context"
"github.com/temporalio/samples-go/updatabletimer"
"log"
"time"
"go.temporal.io/sdk/client"
)
// Signals updatable timer workflow to change wake-up time to 20 seconds from now.
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()
wakeUpTime := time.Now().Add(20 * time.Second)
err = c.SignalWorkflow(context.Background(), updatabletimer.WorkflowID, "", updatabletimer.SignalType, wakeUpTime)
if err != nil {
log.Fatalln("Unable to signale workflow", err)
}
log.Println("Signaled workflow to update wake-up time",
"WorkflowID", updatabletimer.WorkflowID, "WakeUpTime", wakeUpTime)
}