forked from temporalio/samples-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (29 loc) · 877 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
32
33
34
35
36
37
package main
import (
"log"
"go.temporal.io/sdk/client"
"go.temporal.io/sdk/worker"
choice_multi "github.com/temporalio/samples-go/choice-multi"
)
func main() {
// The client and worker are heavyweight objects 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()
w := worker.New(c, "choice-multi", worker.Options{})
w.RegisterWorkflow(choice_multi.MultiChoiceWorkflow)
orderChoices := []string{
choice_multi.OrderChoiceApple,
choice_multi.OrderChoiceBanana,
choice_multi.OrderChoiceCherry,
choice_multi.OrderChoiceOrange}
w.RegisterActivity(&choice_multi.OrderActivities{OrderChoices: orderChoices})
err = w.Run(worker.InterruptCh())
if err != nil {
log.Fatalln("Unable to start worker", err)
}
}