Class AxonServerEventStorageEngineFactory
- All Implemented Interfaces:
ComponentFactory<AxonServerEventStorageEngine>,DescribableComponent
ComponentFactory implementation that generates AxonServerEventStorageEngine instances.- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThenamedelimiter used when deriving the context name for theAxonServerEventStorageEngineunder construction.static final StringThe expected prefix for anynamegiven whenconstructingan instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconstruct(String name, Configuration config) Constructs aComponentcontaining an implementation of the generic typeC.static AxonServerEventStorageEngineconstructForContext(String context, Configuration config) Constructs anAxonServerEventStorageEnginefor the givencontext, retrieving aAxonServerConnectionManagerandEventConverterfrom the givenconfig.voiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.forType()Returns theClassthis factory constructs.voidregisterShutdownHandlers(LifecycleRegistry registry) Registers this factory's shutdown process with the givenregistry.
-
Field Details
-
ENGINE_PREFIX
The expected prefix for anynamegiven whenconstructingan instance. Anempty Optionalwill be returned if thenamedoes not start with"storageEngine".- See Also:
-
CONTEXT_DELIMITER
Thenamedelimiter used when deriving the context name for theAxonServerEventStorageEngineunder construction. If thenamewhenconstructingan instance does not contain this delimiter, anempty Optionalwill be returned.- See Also:
-
-
Constructor Details
-
AxonServerEventStorageEngineFactory
public AxonServerEventStorageEngineFactory()
-
-
Method Details
-
constructForContext
@Nonnull public static AxonServerEventStorageEngine constructForContext(@Nonnull String context, @Nonnull Configuration config) Constructs anAxonServerEventStorageEnginefor the givencontext, retrieving aAxonServerConnectionManagerandEventConverterfrom the givenconfig.The
contextis used to request anAxonServerConnectionfrom theAxonServerConnectionManager.- Parameters:
context- The name of the context for which to open anAxonServerConnectionfor theAxonServerEventStorageEngineunder construction.config- The configuration from which to retrieve anAxonServerConnectionManagerandEventConverterfor theAxonServerEventStorageEngineunder construction.- Returns:
- An
AxonServerEventStorageEngine, connecting to the givencontext.
-
forType
Description copied from interface:ComponentFactoryReturns theClassthis factory constructs.Useful when the generic type is lost due to grouping multiple factories in a collection.
- Specified by:
forTypein interfaceComponentFactory<AxonServerEventStorageEngine>- Returns:
- The
Classthis factory constructs.
-
construct
@Nonnull public Optional<Component<AxonServerEventStorageEngine>> construct(@Nonnull String name, @Nonnull Configuration config) Description copied from interface:ComponentFactoryConstructs aComponentcontaining an implementation of the generic typeC.Implementations of this method may choose to reject the construction by returning an
empty Optionalif thenameis not of an expected format, or when the givenconfigdoes not contain the required components to construct a new instance with.Be certain to invoke any start operation on the new instance of type
Cbefore returning. This is mandatory since factories are only consulted once an application isstarted.- Specified by:
constructin interfaceComponentFactory<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 anempty Optionalif the configuration does not contain the necessary components.- Returns:
- An optional of a
Componentcontaining an implementation of the generic typeC.
-
registerShutdownHandlers
Description copied from interface:ComponentFactoryRegisters this factory's shutdown process with the givenregistry.This typically means the factory registers the shutdown operations of all
constructedcomponents of typeC. This operation might do nothing with theregistrywhen the component of typeCdoes not have any shutdown operations, for example.Since a component factory is consulted after
start-upof aConfiguration, onlyregistered shutdown handlerswill take effect.- Specified by:
registerShutdownHandlersin interfaceComponentFactory<AxonServerEventStorageEngine>- Parameters:
registry- The life cycle registry toregister shutdown handlerswith.
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods 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
DescribableComponentimplementation 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 thedescribeTomethod, 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:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-