Skip to main content

How to set RegisterWorkflowOptions in Go

Create an instance of RegisterOptions from the go.temporal.io/sdk/workflow package and pass it to the RegisterWorkflowWithOptions call when registering the Workflow Type with the Worker.

  • Used to set options for registering a Workflow
FieldRequiredType
NameNostring
DisableAlreadyRegisteredCheckNobool

Name

To customize the Workflow Type, set the Name parameter with RegisterOptions when registering your Workflow with a Worker.

  • Type: string
  • Default: function name
// ...
w := worker.New(temporalClient, "your_task_queue_name", worker.Options{})
registerOptions := workflow.RegisterOptions{
Name: "YourWorkflowName",
// ...
}
w.RegisterWorkflowWithOptions(YourWorkflowDefinition, registerOptions)
// ...

DisableAlreadyRegisteredCheck

Disables the check to see if the Workflow Type has already been registered.

  • Type: bool
  • Default: false
// ...
w := worker.New(temporalClient, "your_task_queue_name", worker.Options{})
registerOptions := workflow.RegisterOptions{
DisableAlreadyRegisteredCheck: `false`,
// ...
}
w.RegisterWorkflowWithOptions(YourWorkflowDefinition, registerOptions)
// ...