How to create a Schedule in a custom Namespace using the Go-SDK

Hi all,

I’m trying to programmatically create schedules using the Golang SDK. No problem creating a schedule in the “default” namespace, but I couldn’t figure out how to create a schedule in another namespace. There doesn’t seem to be any option to specify the namespace in the ScheduleOptions struct (see: sdk-go/internal/schedule_client.go at master · temporalio/sdk-go · GitHub)

What am I missing?

Thanks!

Hi @pgbi

you can set the namespace you want to connect to in the client options sdk-go/internal/client.go at 1350fb4bd58fa0782c774ab198d75e8cafb1fcff · temporalio/sdk-go · GitHub

Antonio

I’m a little confused, there seem to be two ways to create schedules:

  1. Using the schedule client:
c, _ := client.Dial(client.Options{...})
c.ScheduleClient().Create(...)
  1. Using the workflow service
c, _ := client.Dial(client.Options{...})
c.WorkflowService().CreateSchedule(...)

When using the schedule service, the namespace isn’t configurable and it’s using the client Namespace as you mentioned.
When using the workflow service, the namespace seems to be configurable.

I was using the workflow client for the read/delete/update operations, but the schedule client for the create one. Hence my confusion.

Why are there two ways to interact with schedules?