I want my services to self-register their deployment and perform other tasks like initializing cron jobs after the server starts. Currently there is no way to know if the server is started. I am using a combination of goroutines and time.Sleep to approximate what I want. I envision something like this:
func main() {
server.NewRestate().
Bind(restate.Reflect(NewMyService()).
OnStart(handleRestateStart).
Start(ctx, addr)
}
func handleRestateStart() {
// register restate deployment (use force=false in multi-pod environments)
// register cron jobs
// invoke other startup features that depend on restate
}
I want my services to self-register their deployment and perform other tasks like initializing cron jobs after the server starts. Currently there is no way to know if the server is started. I am using a combination of goroutines and
time.Sleepto approximate what I want. I envision something like this: