Considering an array of strings as input, my aim is to schedule cron jobs for each. I have tried creating custom workflow options and executing the same, for each iteration of input. Following this only the first cron workflow gets scheduled while other cron jobs wait indefinitely.
ss_ids := []string{"inputString1","inputString2"}
for ind , sid := range ss_ids {
var cronScheduleStr string
if ind == 0 {
cronScheduleStr = "* * * * *"
}
if ind == 1 {
cronScheduleStr = "2 * * * *"
}
workflowID := "cron_" + sid
workflowOptions := client.StartWorkflowOptions{
ID: workflowID,
TaskQueue: "cron",
CronSchedule: cronScheduleStr,
}
we, err := c.ExecuteWorkflow(context.Background(), workflowOptions, cron.SampleCronWorkflow,sid)
if err != nil {
log.Fatalln("Unable to execute workflow", err)
}
log.Println("Started workflow", "WorkflowID", we.GetID(), "RunID", we.GetRunID())
}
Apart from this I have tried child workflows in the same manner, but that also schedules only the first cron child workflow. Any form of help is much appreciated.