useServices

fun ExtensibleContextBuilderDsl.useServices()

Installs the Services extension onto this extensible environment.

This extension gives you the ability to start and stop services within your environment using the ServiceManager.startAll and ServiceManager.stopAll functions.

Creating services

A service is just a component within a Tegrall DI environment that implements TegralService.

Starting and stopping services

You can retrieve a ServiceManager instance from the environment after having installed this extension by using env.services (where env is the environment). You can in turn use the service manager's startAll and stopAll functions to start and stop all the services.

Excluding services

Services can be excluded from being started or stopped by tagging their declaration with the appropriate tag:

  • To fully ignore a service, use noService

  • To ignore a service when starting, but not ignore when stopping, use noServiceStart

  • To ignore a service when stopping, but not ignore when starting, use noServiceStop