Skip to content

Commit 5454503

Browse files
authored
Expose activity registry on the workflow replayer (#1232)
This is necessary to use worker-instance-registered activities, as otherwise they are unrecognized and may not be able to replay successfully (as a changed activity name is a non-backwards-compatible change).
1 parent 6ad9a67 commit 5454503

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

internal/workflow_replayer.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ func (r *WorkflowReplayer) RegisterWorkflowWithOptions(w interface{}, options Re
120120
r.registry.RegisterWorkflowWithOptions(w, options)
121121
}
122122

123+
// RegisterActivity registers an activity function for this replayer
124+
func (r *WorkflowReplayer) RegisterActivity(a interface{}) {
125+
r.registry.RegisterActivity(a)
126+
}
127+
128+
// RegisterActivityWithOptions registers an activity function for this replayer with custom options, e.g. an explicit name.
129+
func (r *WorkflowReplayer) RegisterActivityWithOptions(a interface{}, options RegisterActivityOptions) {
130+
r.registry.RegisterActivityWithOptions(a, options)
131+
}
132+
123133
// ReplayWorkflowHistory executes a single decision task for the given history.
124134
// Use for testing backwards compatibility of code changes and troubleshooting workflows in a debugger.
125135
// The logger is an optional parameter. Defaults to the noop logger.

worker/worker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ type (
141141
// to ensure that new deployments are not going to break open workflows.
142142
WorkflowReplayer interface {
143143
WorkflowRegistry
144+
ActivityRegistry
144145

145146
// ReplayWorkflowHistory executes a single decision task for the given json history file.
146147
// Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger.

0 commit comments

Comments
 (0)