Class HierarchicalStateManagerConfigurationEnhancer

java.lang.Object
org.axonframework.modelling.HierarchicalStateManagerConfigurationEnhancer
All Implemented Interfaces:
ConfigurationEnhancer

public class HierarchicalStateManagerConfigurationEnhancer extends Object implements ConfigurationEnhancer
ConfigurationEnhancer that registers a decorator for the StateManager that, when a parent configuration is present, wraps child and parent StateManager in a HierarchicalStateManager that delegates to the parent if a state cannot be resolved by the current configuration.

To prevent modules not defining entities not being able to find the StateManager component to access the parent configuration, an empty StateManager is registered when no StateManager is present.

This enhancer is registered with the highest order, so it will be executed last. This is to ensure that any registered StateManager is decorated with the HierarchicalStateManager.

Since:
5.0.0
Author:
Mitchell Herrijgers
  • Constructor Details

    • HierarchicalStateManagerConfigurationEnhancer

      public HierarchicalStateManagerConfigurationEnhancer()
  • Method Details

    • order

      public int order()
      Description copied from interface: ConfigurationEnhancer
      Returns the relative order this enhancer should be invoked in, compared to other instances.

      Use lower (negative) values for enhancers providing sensible defaults, and higher values for enhancers that should be able to override values potentially previously set. Defaults to 0 when not set.

      Specified by:
      order in interface ConfigurationEnhancer
      Returns:
      The order in which this enhancer should be invoked.
    • enhance

      public void enhance(@Nonnull ComponentRegistry componentRegistry)
      Description copied from interface: ConfigurationEnhancer
      Enhances the given registry with, for example, additional components and decorators.
      Specified by:
      enhance in interface ConfigurationEnhancer
      Parameters:
      componentRegistry - The registry instance to enhance.