Skip to content

Commit 4dacc44

Browse files
committed
Update sample with explicit worker name
1 parent 2a6003a commit 4dacc44

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

samples/orchestrator/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log"
66
"time"
77

8+
"github.com/cschleiden/go-workflows/backend"
89
"github.com/cschleiden/go-workflows/client"
910
"github.com/cschleiden/go-workflows/samples"
1011
"github.com/cschleiden/go-workflows/worker"
@@ -17,7 +18,7 @@ func main() {
1718
ctx, cancel := context.WithCancel(context.Background())
1819
defer cancel()
1920

20-
backend := samples.GetBackend("orchestrator")
21+
backend := samples.GetBackend("orchestrator", backend.WithWorkerName("orchestrator-worker"))
2122

2223
orchestrator := worker.NewWorkflowOrchestrator(
2324
backend,
@@ -57,9 +58,9 @@ func main() {
5758

5859
// SimpleWorkflow is a basic workflow that calls an activity and returns its result
5960
func SimpleWorkflow(ctx workflow.Context, message string) (string, error) {
60-
future := workflow.ExecuteActivity[string](ctx, workflow.DefaultActivityOptions, ProcessMessage, message)
61+
f := workflow.ExecuteActivity[string](ctx, workflow.DefaultActivityOptions, ProcessMessage, message)
6162

62-
result, err := future.Get(ctx)
63+
result, err := f.Get(ctx)
6364
if err != nil {
6465
return "", err
6566
}
@@ -72,5 +73,3 @@ func SimpleWorkflow(ctx workflow.Context, message string) (string, error) {
7273
func ProcessMessage(ctx context.Context, message string) (string, error) {
7374
return message + " (processed by activity)", nil
7475
}
75-
76-
// Note: No separate activity function needed when using InlineActivity

0 commit comments

Comments
 (0)