Interface LifecycleOperations

All Known Subinterfaces:
Configuration, Configurer
All Known Implementing Classes:
AxonConfiguration, DefaultConfigurer, SpringConfigurer

public interface LifecycleOperations
Interface describing the configuration of start and shutdown handlers within Axon's configuration.

Both Runnables or LifecycleHandlers can be configured. The invocation order is defined through the (optional) phase parameter. The Phase enumeration may be used as a guidance to add operations before/after Axon's regular steps.

Since:
4.6.0
Author:
Steven van Beelen
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onShutdown(int phase, Runnable shutdownHandler)
    Registers a shutdownHandler to be executed in the given phase when the Configuration is shut down.
    void
    onShutdown(int phase, LifecycleHandler shutdownHandler)
    Registers an asynchronous shutdownHandler to be executed in the given phase when the Configuration is shut down.
    default void
    onShutdown(Runnable shutdownHandler)
    Registers a shutdownHandler to be executed in the default phase 0 when the Configuration is shut down.
    default void
    onStart(int phase, Runnable startHandler)
    Registers a startHandler to be executed in the given phase when this Configuration is started.
    void
    onStart(int phase, LifecycleHandler startHandler)
    Registers an asynchronous startHandler to be executed in the given phase when this Configuration is started.
    default void
    onStart(Runnable startHandler)
    Registers a startHandler to be executed in the default phase 0 when this Configuration is started.
  • Method Details

    • onStart

      default void onStart(Runnable startHandler)
      Registers a startHandler to be executed in the default phase 0 when this Configuration is started.

      The behavior for handlers that are registered when the Configuration is already started is undefined.

      Parameters:
      startHandler - the handler to execute when the configuration is started
      See Also:
    • onStart

      default void onStart(int phase, Runnable startHandler)
      Registers a startHandler to be executed in the given phase when this Configuration is started.

      The behavior for handlers that are registered when the Configuration is already started is undefined.

      Parameters:
      phase - defines a phase in which the start handler will be invoked during Configuration.start(). When starting the configuration the given handlers are started in ascending order based on their phase
      startHandler - the handler to execute when the configuration is started
      See Also:
    • onStart

      void onStart(int phase, LifecycleHandler startHandler)
      Registers an asynchronous startHandler to be executed in the given phase when this Configuration is started.

      The behavior for handlers that are registered when the Configuration is already started is undefined.

      Parameters:
      phase - defines a phase in which the start handler will be invoked during Configuration.start(). When starting the configuration the given handlers are started in ascending order based on their phase
      startHandler - the handler to be executed asynchronously when the configuration is started
      See Also:
    • onShutdown

      default void onShutdown(Runnable shutdownHandler)
      Registers a shutdownHandler to be executed in the default phase 0 when the Configuration is shut down.

      The behavior for handlers that are registered when the Configuration is already shut down is undefined.

      Parameters:
      shutdownHandler - the handler to execute when the Configuration is shut down
      See Also:
    • onShutdown

      default void onShutdown(int phase, Runnable shutdownHandler)
      Registers a shutdownHandler to be executed in the given phase when the Configuration is shut down.

      The behavior for handlers that are registered when the Configuration is already shut down is undefined.

      Parameters:
      phase - defines a phase in which the shutdown handler will be invoked during Configuration.shutdown(). When shutting down the configuration the given handlers are executing in descending order based on their phase
      shutdownHandler - the handler to execute when the Configuration is shut down
      See Also:
    • onShutdown

      void onShutdown(int phase, LifecycleHandler shutdownHandler)
      Registers an asynchronous shutdownHandler to be executed in the given phase when the Configuration is shut down.

      The behavior for handlers that are registered when the Configuration is already shut down is undefined.

      Parameters:
      phase - defines a phase in which the shutdown handler will be invoked during Configuration.shutdown(). When shutting down the configuration the given handlers are executing in descending order based on their phase
      shutdownHandler - the handler to be executed asynchronously when the Configuration is shut down
      See Also: