harp.config.events¶
- class OnBindEvent[source]¶
Bases:
Event
«Bind» event happens before the service container is resolved.
It is the right place to define services that may not be resolvable yet (because their dependencies may, or may not, be defined already).
- __init__(container, settings)[source]¶
- Parameters:
container (Container)
settings (GlobalSettings)
- name = 'harp.config.bind'¶
Event name placeholder, will be set by dispatcher.
- settings: GlobalSettings¶
Global settings.
- class OnBoundEvent[source]¶
Bases:
Event
«Bound» event happens after the service container is resolved, before the kernel creation.
It is the right place to setup things that needs the container to be resolved (thus, you get a provider instead of a container).
- __init__(provider, resolver)[source]¶
- Parameters:
provider (Services)
resolver (ProxyControllerResolver)
- name = 'harp.config.bound'¶
Event name placeholder, will be set by dispatcher.
- resolver: ProxyControllerResolver¶
Proxy controller resolver.
- class OnReadyEvent[source]¶
Bases:
Event
«Ready» event happens after the asgi kernel is created, just before the application starts.
It is the right place to decorate the kernel with middlewares.
- __init__(provider, kernel, binds)[source]¶
- Parameters:
provider (Services)
kernel (ASGIKernel)
- name = 'harp.config.ready'¶
Event name placeholder, will be set by dispatcher.
- class OnShutdownEvent[source]¶
Bases:
Event
«Shutdown» event happens when the application is stopping.
- __init__(kernel, provider)[source]¶
- Parameters:
kernel (ASGIKernel)
provider (Services)
- name = 'harp.config.shutdown'¶
Event name placeholder, will be set by dispatcher.
- EVENT_BIND = 'harp.config.bind'¶
Event fired when the service container is being configured, before the dependencies are resolved. You can configure any services in a listener to this event, but all dependencies must be resolvable once the event is fully dispatched.
- EVENT_BOUND = 'harp.config.bound'¶
Event fired when the service container is fully resolved, before the kernel is created. You can setup things that require live instance of services here.
- EVENT_READY = 'harp.config.ready'¶
Event fired when the application is ready to start. You can decorate the kernel with middlewares here.
- EVENT_SHUTDOWN = 'harp.config.shutdown'¶
Event fired when the application is shutting down. You can cleanup resources here.