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]¶ Base Service class
Parameters: pkg – Attach to this package
Variables: - app – Application instance
- registry – Application ImportRegistry
- pkg – Parent Package
- config – Package configuration
- log – Package logger
-
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
-
on_shutdown
()¶ Called when the Application is shutting down gracefully
-
on_startup
()¶ Called after the Package has been successfully attached to the Application and the Loop is available