Class DefaultAxonApplication
java.lang.Object
org.axonframework.common.configuration.DefaultAxonApplication
- All Implemented Interfaces:
ApplicationConfigurer,LifecycleRegistry
public class DefaultAxonApplication
extends Object
implements ApplicationConfigurer, LifecycleRegistry
Default implementation of the
AxonApplication.- Since:
- 5.0.0
- Author:
- Allard Buijze, Steven van Beelen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns the completely initializedConfigurationinstance of typeCbuilt using thisConfigurerimplementation.componentRegistry(Consumer<ComponentRegistry> componentRegistrar) Executes the givencomponentRegistraron the component registry associated with thisApplicationConfigurer.lifecycleRegistry(Consumer<LifecycleRegistry> lifecycleRegistrar) Executes the givenlifecycleRegistraron the lifecycle registry associated with thisApplicationConfigurer.onShutdown(int phase, LifecycleHandler shutdownHandler) Registers an asynchronousshutdownHandlerto be executed in the givenphasewhen the configuration this registry belongs to is shut down.onStart(int phase, LifecycleHandler startHandler) Registers an asynchronousstartHandlerto be executed in the givenphasewhen the configuration this registry belongs to is started.registerLifecyclePhaseTimeout(long timeout, TimeUnit timeUnit) Configures the timeout of each lifecycle phase.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.common.configuration.ApplicationConfigurer
startMethods inherited from interface org.axonframework.common.configuration.LifecycleRegistry
onShutdown, onShutdown, onShutdown, onShutdown, onStart, onStart, onStart, onStart
-
Constructor Details
-
DefaultAxonApplication
public DefaultAxonApplication()Creates a default axon application.
-
-
Method Details
-
onStart
Description copied from interface:LifecycleRegistryRegisters an asynchronousstartHandlerto be executed in the givenphasewhen the configuration this registry belongs to is started.Handlers cannot be registered when the configuration has already been created from this registry.
- Specified by:
onStartin interfaceLifecycleRegistry- Parameters:
phase- Defines aphasein which the start handler will be invoked duringAxonConfiguration.start(). When starting the configuration the given handlers are started in ascending order based on theirphase.startHandler- The handler to be executed asynchronously when theAxonConfigurationis started.- Returns:
- The current instance of the
LifecycleRegistryfor a fluent API. - See Also:
-
onShutdown
Description copied from interface:LifecycleRegistryRegisters an asynchronousshutdownHandlerto be executed in the givenphasewhen the configuration this registry belongs to is shut down.The behavior for handlers that are registered when the configuration is already shut down is undefined.
- Specified by:
onShutdownin interfaceLifecycleRegistry- Parameters:
phase- Defines a phase in which the shutdown handler will be invoked duringAxonConfiguration.shutdown(). When shutting down the configuration the given handlers are executing in descending order based on theirphase.shutdownHandler- The handler to be executed asynchronously when theAxonConfigurationis shut down.- Returns:
- The current instance of the
LifecycleRegistryfor a fluent API. - See Also:
-
registerLifecyclePhaseTimeout
public DefaultAxonApplication registerLifecyclePhaseTimeout(long timeout, @Nonnull TimeUnit timeUnit) Description copied from interface:LifecycleRegistryConfigures the timeout of each lifecycle phase. TheLifecycleRegistryinvokes lifecycle phases during start-up and shutdown of an application.Note that if a lifecycle phase exceeds the configured
timeoutandtimeUnitcombination, theLifecycleRegistrywill proceed with the following phase. A phase-skip is marked with a warn logging message, as the chances are high this causes undesired side effects.The default lifecycle phase timeout is five seconds.
- Specified by:
registerLifecyclePhaseTimeoutin interfaceLifecycleRegistry- Parameters:
timeout- The amount of time to wait for lifecycle phase completion.timeUnit- The unit in which thetimeoutis expressed.- Returns:
- The current instance of the
LifecycleRegistry, for chaining purposes. - See Also:
-
build
Description copied from interface:ApplicationConfigurerReturns the completely initializedConfigurationinstance of typeCbuilt using thisConfigurerimplementation.It is not recommended to change any configuration on
this ApplicationConfigureronce this method is called.- Specified by:
buildin interfaceApplicationConfigurer- Returns:
- The fully initialized
Configurationinstance of typeC.
-
componentRegistry
public ApplicationConfigurer componentRegistry(@Nonnull Consumer<ComponentRegistry> componentRegistrar) Description copied from interface:ApplicationConfigurerExecutes the givencomponentRegistraron the component registry associated with thisApplicationConfigurer.- Specified by:
componentRegistryin interfaceApplicationConfigurer- Parameters:
componentRegistrar- The actions to take on the component registry.- Returns:
- This
ApplicationConfigurerfor a fluent API.
-
lifecycleRegistry
public ApplicationConfigurer lifecycleRegistry(@Nonnull Consumer<LifecycleRegistry> lifecycleRegistrar) Description copied from interface:ApplicationConfigurerExecutes the givenlifecycleRegistraron the lifecycle registry associated with thisApplicationConfigurer.- Specified by:
lifecycleRegistryin interfaceApplicationConfigurer- Parameters:
lifecycleRegistrar- The actions to take on the lifecycle registry.- Returns:
- This
ApplicationConfigurerfor a fluent API.
-