Class AxonServerEventStorageEngineFactory

java.lang.Object
org.axonframework.axonserver.connector.event.AxonServerEventStorageEngineFactory
All Implemented Interfaces:
ComponentFactory<AxonServerEventStorageEngine>, DescribableComponent

public class AxonServerEventStorageEngineFactory extends Object implements ComponentFactory<AxonServerEventStorageEngine>
A ComponentFactory implementation that generates AxonServerEventStorageEngine instances.
Since:
5.0.0
Author:
Steven van Beelen
  • Field Details

  • Constructor Details

    • AxonServerEventStorageEngineFactory

      public AxonServerEventStorageEngineFactory()
  • Method Details

    • constructForContext

      @Nonnull public static AxonServerEventStorageEngine constructForContext(@Nonnull String context, @Nonnull Configuration config)
      Constructs an AxonServerEventStorageEngine for the given context, retrieving a AxonServerConnectionManager and EventConverter from the given config.

      The context is used to request an AxonServerConnection from the AxonServerConnectionManager.

      Parameters:
      context - The name of the context for which to open an AxonServerConnection for the AxonServerEventStorageEngine under construction.
      config - The configuration from which to retrieve an AxonServerConnectionManager and EventConverter for the AxonServerEventStorageEngine under construction.
      Returns:
      An AxonServerEventStorageEngine, connecting to the given context.
    • forType

      @Nonnull public Class<AxonServerEventStorageEngine> forType()
      Description copied from interface: ComponentFactory
      Returns the Class this factory constructs.

      Useful when the generic type is lost due to grouping multiple factories in a collection.

      Specified by:
      forType in interface ComponentFactory<AxonServerEventStorageEngine>
      Returns:
      The Class this factory constructs.
    • construct

      @Nonnull public Optional<Component<AxonServerEventStorageEngine>> construct(@Nonnull String name, @Nonnull Configuration config)
      Description copied from interface: ComponentFactory
      Constructs a Component containing an implementation of the generic type C.

      Implementations of this method may choose to reject the construction by returning an empty Optional if the name is not of an expected format, or when the given config does not contain the required components to construct a new instance with.

      Be certain to invoke any start operation on the new instance of type C before returning. This is mandatory since factories are only consulted once an application is started.

      Specified by:
      construct in interface ComponentFactory<AxonServerEventStorageEngine>
      Parameters:
      name - The name that's used to request a new instance from this factory. This parameter can be a basis to reject construction.
      config - The configuration to retrieve components from to use during the construction by this factory. A factory may return an empty Optional if the configuration does not contain the necessary components.
      Returns:
      An optional of a Component containing an implementation of the generic type C.
    • registerShutdownHandlers

      public void registerShutdownHandlers(@Nonnull LifecycleRegistry registry)
      Description copied from interface: ComponentFactory
      Registers this factory's shutdown process with the given registry.

      This typically means the factory registers the shutdown operations of all constructed components of type C. This operation might do nothing with the registry when the component of type C does not have any shutdown operations, for example.

      Since a component factory is consulted after start-up of a Configuration, only registered shutdown handlers will take effect.

      Specified by:
      registerShutdownHandlers in interface ComponentFactory<AxonServerEventStorageEngine>
      Parameters:
      registry - The life cycle registry to register shutdown handlers with.
    • describeTo

      public void describeTo(@Nonnull ComponentDescriptor descriptor)
      Description copied from interface: DescribableComponent
      Describe the properties of this DescribableComponent with the given descriptor.

      Components should call the appropriate describeProperty methods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.

      Best Practices: As a general rule, all relevant fields of a DescribableComponent implementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing the describeTo method, who should focus on providing information that is useful for understanding the component's configuration and state.

      Example implementation:

       public void describeTo(ComponentDescriptor descriptor) {
           descriptor.describeProperty("name", this.name);
           descriptor.describeProperty("enabled", this.enabled);
           descriptor.describeProperty("configuration", this.configuration); // A nested component
           descriptor.describeProperty("handlers", this.eventHandlers);      // A collection
       }
       
      Specified by:
      describeTo in interface DescribableComponent
      Parameters:
      descriptor - The component descriptor to describe this DescribableComponentn its properties in.