-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow.go
36 lines (33 loc) · 901 Bytes
/
workflow.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
package app
import (
"fmt"
"time"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
)
func UpdateNumer(ctx workflow.Context, mess string) error {
fmt.Println("Entering UpdateNumer Workflow")
// RetryPolicy specifies how to automatically handle retries if an Activity fails.
retrypolicy := &temporal.RetryPolicy{
InitialInterval: time.Second,
BackoffCoefficient: 2.0,
MaximumInterval: time.Minute,
MaximumAttempts: 500,
}
options := workflow.ActivityOptions{
StartToCloseTimeout: time.Minute,
RetryPolicy: retrypolicy,
}
ctx = workflow.WithActivityOptions(ctx, options)
fmt.Println("Executing the GetInt")
err := workflow.ExecuteActivity(ctx, GetInt).Get(ctx, nil)
if err != nil {
return err
}
fmt.Println("Executing the UpdateInt")
err = workflow.ExecuteActivity(ctx, UpdateInt).Get(ctx, nil)
if err != nil {
return err
}
return nil
}