Skip to content

Provide an OnStart handler on server.Restate #80

@strobus

Description

@strobus

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions