Documentation
¶
Overview ¶
Package worker contains functions to manage lifecycle of a Temporal client side worker.
Index ¶
- Constants
- Variables
- func EnableVerboseLogging(enable bool)
- func InterruptCh() <-chan interface{}
- func PurgeStickyWorkflowCache()
- func SetBinaryChecksum(checksum string)
- func SetStickyWorkflowCacheSize(cacheSize int)
- type ActivityRegistry
- type CompositeTunerOptions
- type DeploymentOptions
- type FixedSizeTunerOptions
- type HasSysInfoProvider
- type NexusServiceRegistry
- type Options
- type Plugin
- type PluginBase
- type PluginConfigureWorkerOptions
- type PluginConfigureWorkerRegistryOptions
- type PluginConfigureWorkflowReplayerOptions
- type PluginConfigureWorkflowReplayerRegistryOptions
- type PluginReplayWorkflowOptions
- type PluginStartWorkerOptions
- type PluginStopWorkerOptions
- type PollerBehavior
- type PollerBehaviorAutoscalingOptions
- type PollerBehaviorSimpleMaximumOptions
- type Registry
- type ReplayWorkflowHistoryOptions
- type ResourceBasedSlotSupplier
- type ResourceBasedSlotSupplierOptions
- type ResourceBasedTunerOptions
- type ResourceController
- type ResourceControllerOptions
- type SlotMarkUsedInfo
- type SlotPermit
- type SlotReleaseInfo
- type SlotReservationInfo
- type SlotSupplier
- type SysInfoContext
- type SysInfoProvider
- type Worker
- type WorkerDeploymentVersion
- type WorkerTuner
- type WorkflowPanicPolicy
- type WorkflowRegistry
- type WorkflowReplayer
- type WorkflowReplayerOptions
Constants ¶
const ( // BlockWorkflow is the default WorkflowPanicPolicy policy for handling workflow panics and detected non-determinism. // This option causes workflow to get stuck in the workflow task retry loop. // It is expected that after the problem is discovered and fixed the workflows are going to continue // without any additional manual intervention. BlockWorkflow = internal.BlockWorkflow // FailWorkflow WorkflowPanicPolicy immediately fails workflow execution if workflow code throws panic or // detects non-determinism. This feature is convenient during development. // WARNING: enabling this in production can cause all open workflows to fail on a single bug or bad deployment. FailWorkflow = internal.FailWorkflow )
Variables ¶
var ( // ErrWorkerShutdown is returned when the worker is shutdown. ErrWorkerShutdown = internal.ErrWorkerShutdown )
Functions ¶
func EnableVerboseLogging ¶
func EnableVerboseLogging(enable bool)
EnableVerboseLogging enable or disable verbose logging of internal Temporal library components. Most customers don't need this feature, unless advised by the Temporal team member. Also there is no guarantee that this API is not going to change.
func InterruptCh ¶ added in v0.28.0
func InterruptCh() <-chan interface{}
InterruptCh returns channel which will get data when system receives interrupt signal from OS. Pass it to worker.Run() func to stop worker with Ctrl+C.
func PurgeStickyWorkflowCache ¶ added in v1.3.0
func PurgeStickyWorkflowCache()
PurgeStickyWorkflowCache resets the sticky workflow cache. This must be called only when all workers are stopped.
func SetBinaryChecksum ¶
func SetBinaryChecksum(checksum string)
SetBinaryChecksum sets the identifier of the binary(aka BinaryChecksum). The identifier is mainly used in recording reset points when respondWorkflowTaskCompleted. For each workflow, the very first workflow task completed by a binary will be associated as a auto-reset point for the binary. So that when a customer wants to mark the binary as bad, the workflow will be reset to that point -- which means workflow will forget all progress generated by the binary. On another hand, once the binary is marked as bad, the bad binary cannot poll workflow queue and make any progress any more.
func SetStickyWorkflowCacheSize ¶
func SetStickyWorkflowCacheSize(cacheSize int)
SetStickyWorkflowCacheSize sets the cache size for sticky workflow cache. Sticky workflow execution is the affinity between workflow tasks of a specific workflow execution to a specific worker. The benefit of sticky execution is that the workflow does not have to reconstruct state by replaying history from the beginning. The cache is shared between workers running within same process. This must be called before any worker is started. If not called, the default size of 10K (which may change) will be used.
Types ¶
type ActivityRegistry ¶ added in v1.3.0
type ActivityRegistry interface {
// RegisterActivity - register an activity function or a pointer to a structure with the worker.
// An activity function takes a context and input and returns a (result, error) or just error.
//
// And activity struct is a structure with all its exported methods treated as activities. The default
// name of each activity is the method name.
//
// Examples:
// func sampleActivity(ctx context.Context, input []byte) (result []byte, err error)
// func sampleActivity(ctx context.Context, arg1 int, arg2 string) (result *customerStruct, err error)
// func sampleActivity(ctx context.Context) (err error)
// func sampleActivity() (result string, err error)
// func sampleActivity(arg1 bool) (result int, err error)
// func sampleActivity(arg1 bool) (err error)
//
// type Activities struct {
// // fields
// }
// func (a *Activities) SampleActivity1(ctx context.Context, arg1 int, arg2 string) (result *customerStruct, err error) {
// ...
// }
//
// func (a *Activities) SampleActivity2(ctx context.Context, arg1 int, arg2 *customerStruct) (result string, err error) {
// ...
// }
//
// Serialization of all primitive types, structures is supported ... except channels, functions, variadic, unsafe pointer.
// This method panics if activityFunc doesn't comply with the expected format or an activity with the same
// type name is registered more than once.
RegisterActivity(a interface{})
// RegisterActivityWithOptions registers the activity function or struct pointer with options.
// The user can use options to provide an external name for the activity or leave it empty if no
// external name is required. This can be used as
// worker.RegisterActivityWithOptions(barActivity, RegisterActivityOptions{})
// worker.RegisterActivityWithOptions(barActivity, RegisterActivityOptions{Name: "barExternal"})
// When registering the structure that implements activities the name is used as a prefix that is
// prepended to the activity method name.
// worker.RegisterActivityWithOptions(&Activities{ ... }, RegisterActivityOptions{Name: "MyActivities_"})
// To override each name of activities defined through a structure register the methods one by one:
// activities := &Activities{ ... }
// worker.RegisterActivityWithOptions(activities.SampleActivity1, RegisterActivityOptions{Name: "Sample1"})
// worker.RegisterActivityWithOptions(activities.SampleActivity2, RegisterActivityOptions{Name: "Sample2"})
// See RegisterActivity function for more info.
// The other use of options is to disable duplicated activity registration check
// which might be useful for integration tests.
// worker.RegisterActivityWithOptions(barActivity, RegisterActivityOptions{DisableAlreadyRegisteredCheck: true})
RegisterActivityWithOptions(a interface{}, options activity.RegisterOptions)
// RegisterDynamicActivity registers the dynamic activity function with options.
// Registering activities via a structure is not supported for dynamic activities.
RegisterDynamicActivity(a interface{}, options activity.DynamicRegisterOptions)
}
ActivityRegistry exposes activity registration functions to consumers.
type CompositeTunerOptions ¶ added in v1.29.0
type CompositeTunerOptions = internal.CompositeTunerOptions
CompositeTunerOptions are the options used by NewCompositeTuner.
type DeploymentOptions ¶ added in v1.32.0
type DeploymentOptions = internal.WorkerDeploymentOptions
DeploymentOptions provides configuration to enable Worker Versioning.
type FixedSizeTunerOptions ¶ added in v1.29.0
type FixedSizeTunerOptions = internal.FixedSizeTunerOptions
FixedSizeTunerOptions are the options used by NewFixedSizeTuner.
type HasSysInfoProvider ¶ added in v1.41.0
type HasSysInfoProvider = internal.HasSysInfoProvider
HasSysInfoProvider is an optional interface that SlotSupplier implementations can implement to expose their SysInfoProvider.
type NexusServiceRegistry ¶ added in v1.28.0
type NexusServiceRegistry interface {
// RegisterNexusService registers a service with a worker. Panics if a service with the same name has
// already been registered on this worker or if the worker has already been started. A worker will only
// poll for Nexus tasks if any services are registered on it.
RegisterNexusService(*nexus.Service)
}
NexusServiceRegistry exposes Nexus Service registration functions.
type Options ¶
type Options = internal.WorkerOptions
Options is used to configure a worker instance.
type Plugin ¶ added in v1.39.0
type Plugin = internal.WorkerPlugin
Plugin is a plugin that can configure worker/replayer options and surround worker/replayer runs. Many plugin implementers may prefer the simpler go.temporal.io/sdk/temporal.SimplePlugin instead.
All worker plugins must embed go.temporal.io/sdk/worker.PluginBase. All plugins must implement Name().
NOTE: Experimental
type PluginBase ¶ added in v1.39.0
type PluginBase = internal.WorkerPluginBase
PluginBase must be embedded into worker plugin implementations.
NOTE: Experimental
type PluginConfigureWorkerOptions ¶ added in v1.39.0
type PluginConfigureWorkerOptions = internal.WorkerPluginConfigureWorkerOptions
PluginConfigureWorkerOptions are options for ConfigureWorker on a worker plugin.
NOTE: Experimental
type PluginConfigureWorkerRegistryOptions ¶ added in v1.39.0
type PluginConfigureWorkerRegistryOptions = internal.WorkerPluginConfigureWorkerRegistryOptions
PluginConfigureWorkerRegistryOptions are the set of callbacks that can be adjusted by plugins when configuring workers. If adjusting a callback that is already set, implementers may want to take care to invoke the existing callback inside their own.
NOTE: Experimental
type PluginConfigureWorkflowReplayerOptions ¶ added in v1.39.0
type PluginConfigureWorkflowReplayerOptions = internal.WorkerPluginConfigureWorkflowReplayerOptions
PluginConfigureWorkflowReplayerOptions are options for ConfigureWorkflowReplayer on a worker plugin.
NOTE: Experimental
type PluginConfigureWorkflowReplayerRegistryOptions ¶ added in v1.39.0
type PluginConfigureWorkflowReplayerRegistryOptions = internal.WorkerPluginConfigureWorkflowReplayerRegistryOptions
PluginConfigureWorkflowReplayerRegistryOptions are the set of callbacks that can be adjusted by plugins when configuring workflow replayers. If adjusting a callback that is already set, implementers may want to take care to invoke the existing callback inside their own.
NOTE: Experimental
type PluginReplayWorkflowOptions ¶ added in v1.39.0
type PluginReplayWorkflowOptions = internal.WorkerPluginReplayWorkflowOptions
PluginReplayWorkflowOptions are options for ReplayWorkflow on a worker plugin.
NOTE: Experimental
type PluginStartWorkerOptions ¶ added in v1.39.0
type PluginStartWorkerOptions = internal.WorkerPluginStartWorkerOptions
PluginStartWorkerOptions are options for StartWorker on a worker plugin.
NOTE: Experimental
type PluginStopWorkerOptions ¶ added in v1.39.0
type PluginStopWorkerOptions = internal.WorkerPluginStopWorkerOptions
PluginStopWorkerOptions are options for StopWorker on a worker plugin.
NOTE: Experimental
type PollerBehavior ¶ added in v1.36.0
type PollerBehavior = internal.PollerBehavior
PollerBehavior is used to configure the behavior of the poller.
func NewPollerBehaviorAutoscaling ¶ added in v1.36.0
func NewPollerBehaviorAutoscaling( options PollerBehaviorAutoscalingOptions, ) PollerBehavior
NewPollerBehaviorAutoscaling creates a PollerBehavior that allows the worker to scale the number of pollers within a given range. based on the workflow and feedback from the server.
func NewPollerBehaviorSimpleMaximum ¶ added in v1.36.0
func NewPollerBehaviorSimpleMaximum( options PollerBehaviorSimpleMaximumOptions, ) PollerBehavior
NewPollerBehaviorSimpleMaximum creates a PollerBehavior that allows the worker to start up to a maximum number of pollers.
type PollerBehaviorAutoscalingOptions ¶ added in v1.36.0
type PollerBehaviorAutoscalingOptions = internal.PollerBehaviorAutoscalingOptions
PollerBehaviorAutoscalingOptions is the options for NewPollerBehaviorAutoscaling.
type PollerBehaviorSimpleMaximumOptions ¶ added in v1.36.0
type PollerBehaviorSimpleMaximumOptions = internal.PollerBehaviorSimpleMaximumOptions
PollerBehaviorSimpleMaximumOptions is the options for NewPollerBehaviorSimpleMaximum.
type Registry ¶ added in v1.3.0
type Registry interface {
WorkflowRegistry
ActivityRegistry
NexusServiceRegistry
}
Registry exposes registration functions to consumers.
type ReplayWorkflowHistoryOptions ¶ added in v1.20.0
type ReplayWorkflowHistoryOptions = internal.ReplayWorkflowHistoryOptions
ReplayWorkflowHistoryOptions are options for replaying a workflow.
type ResourceBasedSlotSupplier ¶ added in v1.41.0
type ResourceBasedSlotSupplier = internal.ResourceBasedSlotSupplier
ResourceBasedSlotSupplier is a SlotSupplier that issues slots based on system resource usage.
func NewResourceBasedSlotSupplier ¶ added in v1.41.0
func NewResourceBasedSlotSupplier( controller *ResourceController, options ResourceBasedSlotSupplierOptions, ) (*ResourceBasedSlotSupplier, error)
NewResourceBasedSlotSupplier creates a ResourceBasedSlotSupplier given the provided ResourceController and ResourceBasedSlotSupplierOptions. All ResourceBasedSlotSupplier instances must use the same ResourceController.
type ResourceBasedSlotSupplierOptions ¶ added in v1.41.0
type ResourceBasedSlotSupplierOptions = internal.ResourceBasedSlotSupplierOptions
ResourceBasedSlotSupplierOptions configures a particular ResourceBasedSlotSupplier.
func DefaultActivityResourceBasedSlotSupplierOptions ¶ added in v1.41.0
func DefaultActivityResourceBasedSlotSupplierOptions() ResourceBasedSlotSupplierOptions
DefaultActivityResourceBasedSlotSupplierOptions returns default options for activity slot suppliers.
func DefaultWorkflowResourceBasedSlotSupplierOptions ¶ added in v1.41.0
func DefaultWorkflowResourceBasedSlotSupplierOptions() ResourceBasedSlotSupplierOptions
DefaultWorkflowResourceBasedSlotSupplierOptions returns default options for workflow slot suppliers.
type ResourceBasedTunerOptions ¶ added in v1.41.0
type ResourceBasedTunerOptions = internal.ResourceBasedTunerOptions
ResourceBasedTunerOptions configures a resource-based tuner.
type ResourceController ¶ added in v1.41.0
type ResourceController = internal.ResourceController
ResourceController is used by ResourceBasedSlotSupplier to make decisions about whether slots should be issued based on system resource usage.
func NewResourceController ¶ added in v1.41.0
func NewResourceController(options ResourceControllerOptions) *ResourceController
NewResourceController creates a new ResourceController with the provided options.
InfoSupplier is required - use contrib/sysinfo.SysInfoProvider() for a gopsutil-based implementation, or provide your own.
WARNING: It is important that you do not create multiple InfoSupplier instances. Since InfoSupplier looks at overall system resources, multiple instances with different configs can only conflict with one another.
type ResourceControllerOptions ¶ added in v1.41.0
type ResourceControllerOptions = internal.ResourceControllerOptions
ResourceControllerOptions contains configurable parameters for a ResourceController. It is recommended to use DefaultResourceControllerOptions to create a ResourceControllerOptions and only modify the mem/cpu target percent fields.
func DefaultResourceControllerOptions ¶ added in v1.41.0
func DefaultResourceControllerOptions() ResourceControllerOptions
DefaultResourceControllerOptions returns a ResourceControllerOptions with default values.
type SlotMarkUsedInfo ¶ added in v1.29.0
type SlotMarkUsedInfo = internal.SlotMarkUsedInfo
SlotMarkUsedInfo contains information that SlotSupplier instances can use during SlotSupplier.MarkSlotUsed calls.
type SlotPermit ¶ added in v1.29.0
type SlotPermit = internal.SlotPermit
SlotPermit is a permit to use a slot.
type SlotReleaseInfo ¶ added in v1.29.0
type SlotReleaseInfo = internal.SlotReleaseInfo
SlotReleaseInfo contains information that SlotSupplier instances can use during SlotSupplier.ReleaseSlot calls.
type SlotReservationInfo ¶ added in v1.29.0
type SlotReservationInfo = internal.SlotReservationInfo
SlotReservationInfo contains information that SlotSupplier instances can use during reservation calls.
type SlotSupplier ¶ added in v1.29.0
type SlotSupplier = internal.SlotSupplier
SlotSupplier controls how slots are handed out for workflow and activity tasks as well as local activities when used in conjunction with a WorkerTuner.
func NewFixedSizeSlotSupplier ¶ added in v1.29.0
func NewFixedSizeSlotSupplier(numSlots int) (SlotSupplier, error)
NewFixedSizeSlotSupplier creates a new FixedSizeSlotSupplier with the given number of slots.
type SysInfoContext ¶ added in v1.41.0
type SysInfoContext = internal.SysInfoContext
SysInfoContext provides context for SysInfoProvider calls.
type SysInfoProvider ¶ added in v1.41.0
type SysInfoProvider = internal.SysInfoProvider
SysInfoProvider implementations provide information about system resources. Use contrib/sysinfo.SysInfoProvider() for a gopsutil-based implementation, or provide your own.
type Worker ¶
type Worker interface {
Registry
// Start the worker in a non-blocking fashion.
//
// Note, this will only return errors on start. To catch errors during run,
// use Run() instead or set Options.OnFatalError.
Start() error
// Run the worker in a blocking fashion. Stop the worker when interruptCh receives signal.
// Pass worker.InterruptCh() to stop the worker with SIGINT or SIGTERM.
// Pass nil to stop the worker with external Stop() call.
// Pass any other `<-chan interface{}` and Run will wait for signal from that channel.
// Returns error if the worker fails to start or there is a fatal error
// during execution.
//
// Users are encouraged to use Start() instead of this call if they plan to
// manually Stop(). Otherwise a race can occur if shutdown occurs before the
// worker is started. This Run() call is only best if shutdown is initiated
// via the interrupt channel.
Run(interruptCh <-chan interface{}) error
// Stop the worker.
//
// This may panic if called a second time.
Stop()
}
Worker hosts workflow and activity implementations. Use worker.New(...) to create an instance.
func New ¶
New creates an instance of worker for managing workflow and activity executions.
client - the client for use by the worker
taskQueue - is the task queue name you use to identify your client worker, also
identifies group of workflow and activity implementations that are
hosted by a single worker process
options - configure any worker specific options like logger, metrics, identity
type WorkerDeploymentVersion ¶ added in v1.35.0
type WorkerDeploymentVersion = internal.WorkerDeploymentVersion
WorkerDeploymentVersion represents a specific version of a worker in a deployment.
type WorkerTuner ¶ added in v1.29.0
type WorkerTuner = internal.WorkerTuner
WorkerTuner allows for the dynamic customization of some aspects of worker behavior.
func NewCompositeTuner ¶ added in v1.29.0
func NewCompositeTuner(options CompositeTunerOptions) (WorkerTuner, error)
NewCompositeTuner creates a WorkerTuner that uses a combination of slot suppliers.
func NewFixedSizeTuner ¶ added in v1.29.0
func NewFixedSizeTuner(options FixedSizeTunerOptions) (WorkerTuner, error)
NewFixedSizeTuner creates a WorkerTuner that uses fixed size slot suppliers.
func NewResourceBasedTuner ¶ added in v1.41.0
func NewResourceBasedTuner(opts ResourceBasedTunerOptions) (WorkerTuner, error)
NewResourceBasedTuner creates a WorkerTuner that dynamically adjusts the number of slots based on system resources. Specify the target CPU and memory usage as a value between 0 and 1.
InfoSupplier is required - use contrib/sysinfo.SysInfoProvider() for a gopsutil-based implementation, or provide your own.
type WorkflowPanicPolicy ¶
type WorkflowPanicPolicy = internal.WorkflowPanicPolicy
WorkflowPanicPolicy is used for configuring how worker deals with workflow code panicking which includes non backwards compatible changes to the workflow code without appropriate versioning (see workflow.GetVersion). The default behavior is to block workflow execution until the problem is fixed.
type WorkflowRegistry ¶ added in v1.3.0
type WorkflowRegistry interface {
// RegisterWorkflow - registers a workflow function with the worker.
// A workflow takes a [workflow.Context] and input and returns a (result, error) or just error.
// Examples:
// func sampleWorkflow(ctx workflow.Context, input []byte) (result []byte, err error)
// func sampleWorkflow(ctx workflow.Context, arg1 int, arg2 string) (result []byte, err error)
// func sampleWorkflow(ctx workflow.Context) (result []byte, err error)
// func sampleWorkflow(ctx workflow.Context, arg1 int) (result string, err error)
// Serialization of all primitive types, structures is supported ... except channels, functions, variadic, unsafe pointer.
// For global registration consider workflow.Register
// This method panics if workflowFunc doesn't comply with the expected format or tries to register the same workflow
RegisterWorkflow(w interface{})
// RegisterWorkflowWithOptions registers the workflow function with options.
// The user can use options to provide an external name for the workflow or leave it empty if no
// external name is required. This can be used as
// worker.RegisterWorkflowWithOptions(sampleWorkflow, RegisterWorkflowOptions{})
// worker.RegisterWorkflowWithOptions(sampleWorkflow, RegisterWorkflowOptions{Name: "foo"})
// This method panics if workflowFunc doesn't comply with the expected format or tries to register the same workflow
// type name twice. Use workflow.RegisterOptions.DisableAlreadyRegisteredCheck to allow multiple registrations.
RegisterWorkflowWithOptions(w interface{}, options workflow.RegisterOptions)
// RegisterDynamicWorkflow registers the dynamic workflow function with options.
RegisterDynamicWorkflow(w interface{}, options workflow.DynamicRegisterOptions)
}
WorkflowRegistry exposes workflow registration functions to consumers.
type WorkflowReplayer ¶
type WorkflowReplayer interface {
// RegisterWorkflow registers workflow that is going to be replayed
RegisterWorkflow(w interface{})
// RegisterWorkflowWithOptions registers workflow that is going to be replayed with user provided name
RegisterWorkflowWithOptions(w interface{}, options workflow.RegisterOptions)
// RegisterDynamicWorkflow registers dynamic workflow that is going to be replayed
RegisterDynamicWorkflow(w interface{}, options workflow.DynamicRegisterOptions)
// ReplayWorkflowHistory executes a single workflow task for the given json history file.
// Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger.
// The logger is an optional parameter. Defaults to the noop logger.
//
// History can be loaded from a reader with client.HistoryFromJSON.
ReplayWorkflowHistory(logger log.Logger, history *historypb.History) error
// ReplayWorkflowHistoryWithOptions executes a single workflow task for the given json history file.
// Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger.
// The logger is an optional parameter. Defaults to the noop logger. Options allow aditional customization when
// replaying this history.
//
// History can be loaded from a reader with client.HistoryFromJSON.
ReplayWorkflowHistoryWithOptions(logger log.Logger, history *historypb.History, options ReplayWorkflowHistoryOptions) error
// ReplayWorkflowHistoryFromJSONFile executes a single workflow task for the json history file downloaded from the cli.
// To download the history file: temporal workflow show --workflow-id <workflow_id> --output json > <output_file>
// See https://docs.temporal.io/cli and https://github.com/temporalio/cli for full documentation.
// Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger.
// The logger is an optional parameter. Defaults to the noop logger.
ReplayWorkflowHistoryFromJSONFile(logger log.Logger, jsonfileName string) error
// ReplayPartialWorkflowHistoryFromJSONFile executes a single workflow task for the json history file upto provided
// lastEventID(inclusive), downloaded from the cli.
// To download the history file: temporal workflow show --workflow-id <workflow_id> --output json > <output_file>
// See https://docs.temporal.io/cli and https://github.com/temporalio/cli for full documentation.
// Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger.
// The logger is an optional parameter. Defaults to the noop logger.
ReplayPartialWorkflowHistoryFromJSONFile(logger log.Logger, jsonfileName string, lastEventID int64) error
// ReplayWorkflowExecution loads a workflow execution history from the Temporal service and executes a single workflow task for it.
// Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger.
// The logger is the only optional parameter. Defaults to the noop logger. The Run ID and Workflow ID used during replay are derived
// from execution.
ReplayWorkflowExecution(ctx context.Context, service workflowservice.WorkflowServiceClient, logger log.Logger, namespace string, execution workflow.Execution) error
}
WorkflowReplayer supports replaying a workflow from its event history. Use for troubleshooting and backwards compatibility unit tests. For example if a workflow failed in production then its history can be downloaded through UI or CLI and replayed in a debugger as many times as necessary. Use this class to create unit tests that check if workflow changes are backwards compatible. It is important to maintain backwards compatibility through use of workflow.GetVersion to ensure that new deployments are not going to break open workflows.
func NewWorkflowReplayer ¶
func NewWorkflowReplayer() WorkflowReplayer
NewWorkflowReplayer creates a WorkflowReplayer instance.
func NewWorkflowReplayerWithOptions ¶ added in v1.11.0
func NewWorkflowReplayerWithOptions(options WorkflowReplayerOptions) (WorkflowReplayer, error)
NewWorkflowReplayerWithOptions creates a WorkflowReplayer instance with the given options.
type WorkflowReplayerOptions ¶ added in v1.11.0
type WorkflowReplayerOptions = internal.WorkflowReplayerOptions
WorkflowReplayerOptions are options used for NewWorkflowReplayerWithOptions.