Tegral Services
Tegral Services is a simple API for defining startable and stoppable services.
These services are simply classes that implement TegralService and that get put in a services-enabled Tegral DI environment
In order to make using services easier, Tegral Services also provides a feature (ServicesFeature) that automatically sets up the Tegral DI services extension for you when enabled.
Package information
| Package name | Catalog dependency | Full Gradle name |
|---|---|---|
tegral-services-api | tegralLibs.services.api | guru.zoroark.tegral:tegral-services-api:VERSION |
tegral-services-feature | tegralLibs.services.feature | guru.zoroark.tegral:tegral-services-feature:VERSION |
Writing services
Services can be written simply by implementing the TegralService interface and implementing relevant functions:
class MyService : TegralService {
override suspend fun start() {
// ...
}
override suspend fun stop() {
// ...
}
}