Schedule creation with SpringBoot

Hi all,

Is there a recommended way to create a schedule when using SpringBoot. I am able to create it on the Spring ApplicationStarted event and everything works the first time. But on subsequent runs, it’s complains about Schedule already created. Should I change my code to always check if schedule exists before creating or is the recommendation to not create schedule via code?

Thanks

Unless you are explicitly deleting your created schedules on like Spring ContextClosedEvent, you are trying to create schedule with same id on each of your application start.
In that case you will need to handle
io.temporal.client.schedules.ScheduleAlreadyRunningException
on schedule creation as the schedule itself runs on server and would persist your app restarts.

Thanks. For now I’ve gone with a check to see if the schedule already exists before trying to create one. Might consider moving the schedule creation to some script outside my application workflow.