Skip to content

Lifecycle events

Implement any of these on a provider:

func (s *Store) OnModuleInit(ctx context.Context) error // connect
func (s *Store) OnApplicationBootstrap(ctx context.Context) error // start workers
func (s *Store) OnModuleDestroy(ctx context.Context) error // stop workers
func (s *Store) BeforeApplicationShutdown(ctx context.Context, sig string) error
func (s *Store) OnApplicationShutdown(ctx context.Context, sig string) error // close connections

Startup goes from modules with no imports up to the root; shutdown goes the other way.