Service¶
The Service layer typically takes care of interacting with external applications: Databases, Remote Web APIs, Message Queues, etc.
Services can be connected and–to provide a good level of flexibility–supports both Inheritance and two types of Composition.
Check out the Connecting Services example to see how a service can integrate and interact with other services.
-
class
aioli.service.
BaseService
(pkg)[source]¶ -
connect
(svc)[source]¶ Reuses existing instance of the given Service class, in the context of the Package it was first registered with.
- Parameters
svc – Service class
- Returns
Existing Service instance
-
integrate
(svc)[source]¶ Creates a new instance of the given Service class in the context of the current Package.
- Parameters
svc – Service class
- Returns
Service instance
-
async
on_shutdown
()¶ Called when the Application is shutting down gracefully
-
async
on_startup
()¶ Called after the Package has been successfully attached to the Application
-