Lifecycle
Interface for components that have a lifecycle with start and stop operations.
Implementations of this interface can be started and stopped gracefully. The start method initializes the component, while stop methods handle shutdown.
This is useful for services, dispatchers, and other managed components.
Example usage:
class MyService : Lifecycle {
override fun start() {
// Initialize resources
println("Service started")
}
override fun stopGracefully(): Mono<Void> {
// Clean up
return Mono.empty()
}
}
val service = MyService()
service.start()
// ... use service ...
service.stop() // Graceful shutdownContent copied to clipboard
See also
for stop operations