Package org.axonframework.lifecycle
Interface Lifecycle.LifecycleRegistry
- Enclosing interface:
Lifecycle
public static interface Lifecycle.LifecycleRegistry
Interface towards the registry that holds all lifecycle handlers for components.
Component may register activities to be executed at startup or shutdown. These activities may be executed
- synchronously - see
onStart(int, Runnable)andonShutdown(int, Runnable). With this approach, the lifecycle action is considered completed when the method returns. - asynchronously - see
onStart(int, LifecycleHandler)andonShutdown(int, LifecycleHandler). This approach expects handler methods to return aCompletableFuturethat completes when the lifecycle action is completed
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidonShutdown(int phase, Runnable action) Registers the givenactionto run during the givenphaseduring shutdown.voidonShutdown(int phase, Lifecycle.LifecycleHandler action) Registers the givenactionto run during the givenphaseduring shutdown.default voidRegisters the givenactionto run during the givenphaseduring startup.voidonStart(int phase, Lifecycle.LifecycleHandler action) Registers the givenactionto run during the givenphaseduring startup.
-
Method Details
-
onStart
Registers the givenactionto run during the givenphaseduring startup. Lowerphases are executed before higherphases.- Parameters:
phase- The phase in which to execute this actionaction- The action to perform- See Also:
-
onShutdown
Registers the givenactionto run during the givenphaseduring shutdown. Higherphases are executed before lowerphases.- Parameters:
phase- The phase in which to execute this actionaction- The action to perform- See Also:
-
onStart
Registers the givenactionto run during the givenphaseduring startup. Lowerphases are executed before higherphases.Various handlers for the same phase may be executed concurrently, but handlers for subsequent phases will only be invoked when the returned
CompletableFuturecompletes (normally or exceptionally).- Parameters:
phase- The phase in which to execute this actionaction- The action to perform- See Also:
-
onShutdown
Registers the givenactionto run during the givenphaseduring shutdown. Higherphases are executed before lowerphases.Various handlers for the same phase may be executed concurrently, but handlers for subsequent phases will only be invoked when the returned
CompletableFuturecompletes (normally or exceptionally).- Parameters:
phase- The phase in which to execute this actionaction- The action to perform- See Also:
-