36 lines
676 B
Go
36 lines
676 B
Go
package app
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.temporal.io/sdk/temporal"
|
|
"go.temporal.io/sdk/workflow"
|
|
)
|
|
|
|
func RegistrationWorkflow(ctx workflow.Context, name string) (string, error) {
|
|
retryPolicy := &temporal.RetryPolicy{
|
|
InitialInterval: time.Second,
|
|
BackoffCoefficient: 2.0,
|
|
MaximumInterval: 512 * time.Second,
|
|
MaximumAttempts: 64,
|
|
}
|
|
|
|
options := workflow.ActivityOptions{
|
|
StartToCloseTimeout: time.Minute,
|
|
RetryPolicy: retryPolicy,
|
|
}
|
|
|
|
ctx = workflow.WithActivityOptions(ctx, options)
|
|
|
|
//
|
|
|
|
var result string
|
|
err := workflow.ExecuteActivity(ctx, ComposeGreeting, name).Get(ctx, &result)
|
|
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return result, err
|
|
}
|