const mixinafIoc::RegistryShutdownHub
afIoc::RegistryShutdownHub
(Service) - Event hub for notifications when the Registry shuts down. All listeners need to immutable funcs, which essentially means only const
classes can contribute.
Common usage is add listeners in your service ctor:
new make(RegistryShutdownHub shutdownHub) { shutdownHub.addRegistryShutdownListener |->| { this.shutdown } }
- addRegistryShutdownListener
abstract Void addRegistryShutdownListener(Str id, Str[] constraints, |->Void listener)
Adds a listener that will be notified when the registry shuts down. Note when shutdown listeners are called, the state of other dependent services is unassured. If your listener depends on other services use
addRegistryWillShutdownListener()
Errs thrown by the listener will be logged and ignored.
Each listener has a unique id (case insensitive) that is used by the constraints for ordering. Each constraint must start with the prefix
BEFORE:
orAFTER:
.config.addOrdered("Breakfast", eggs) config.addOrdered("Lunch", ["AFTER: breakfast", "BEFORE: dinner"], ham) config.addOrdered("Dinner", pie)
- addRegistryWillShutdownListener
abstract Void addRegistryWillShutdownListener(Str id, Str[] constraints, |->Void listener)
Adds a listener that will be notified when the registry shuts down. RegistryWillShutdown listeners are notified before shutdown listeners.
Errs thrown by the listener will be logged and ignored.
Each listener has a unique id (case insensitive) that is used by the constraints for ordering. Each constraint must start with the prefix
BEFORE:
orAFTER:
.config.addOrdered("Breakfast", eggs) config.addOrdered("Lunch", ["AFTER: breakfast", "BEFORE: dinner"], ham) config.addOrdered("Dinner", pie)