Skip to content

Commit 8c0bbac

Browse files
committed
Fixes get workflow names
Signed-off-by: joshvanl <[email protected]>
1 parent db30df7 commit 8c0bbac

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

workflow/registry.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package workflow
22

33
import (
4+
"github.com/dapr/durabletask-go/api/helpers"
45
"github.com/dapr/durabletask-go/task"
56
)
67

@@ -20,9 +21,7 @@ func NewRegistry() *Registry {
2021
// AddWorkflow adds an orchestrator function to the registry. The name of the orchestrator
2122
// function is determined using reflection.
2223
func (r *Registry) AddWorkflow(w Workflow) error {
23-
return r.registry.AddOrchestrator(func(ctx *task.OrchestrationContext) (any, error) {
24-
return w(&WorkflowContext{ctx})
25-
})
24+
return r.AddWorkflowN(helpers.GetTaskFunctionName(w), w)
2625
}
2726

2827
// AddWorkflowN adds an orchestrator function to the registry with a
@@ -36,9 +35,7 @@ func (r *Registry) AddWorkflowN(name string, w Workflow) error {
3635
// AddActivity adds an activity function to the registry. The name of the
3736
// activity function is determined using reflection.
3837
func (r *Registry) AddActivity(a Activity) error {
39-
return r.registry.AddActivity(func(ctx task.ActivityContext) (any, error) {
40-
return a(ctx.(ActivityContext))
41-
})
38+
return r.AddActivityN(helpers.GetTaskFunctionName(a), a)
4239
}
4340

4441
// AddActivityN adds an activity function to the registry with a specified

0 commit comments

Comments
 (0)