Service

The typical Service Component takes care of interacting with external systems: Databases, Remote Web APIs, Messaging systems, etc. and provides an API for internal consumption.

Check out the Connecting Services example to see how a service can integrate and interact with other services.

class aioli.service.BaseService(unit, config_override=None)[source]

Base Service class

Parameters:

unit – Attach to this unit

Variables:
  • app – Application instance
  • registry – Application ImportRegistry
  • unit – Parent Unit
  • config – Unit configuration
  • log – Unit logger
connect(cls)[source]

Reuses existing instance of the given Service class, in the context of the Unit it was first registered with.

Parameters:cls – Service class
Returns:Existing Service instance
integrate(cls)[source]

Creates a new instance of the given Service class in the context of the current Unit.

Parameters:cls – Service class
Returns:Integrated Service
on_shutdown()

Called when the Application is shutting down gracefully

on_startup()

Called after the Unit has been successfully attached to the Application and the Loop is available