Class AggregateBasedAxonServerTenantEventStorageEngineFactory
- All Implemented Interfaces:
MultiTenantAwareComponent,TenantEventStorageEngineFactory,DescribableComponent
TenantEventStorageEngineFactory, building one
AggregateBasedAxonServerEventStorageEngine per tenant against that tenant's Axon Server context.
This factory is for tenants backed by Axon Server contexts without Dynamic Consistency Boundary support. The
aggregate-based engine is created lazily and cached, and evicted on tenant removal, by a
TenantScopedCache this factory holds. Following the tenant lifecycle is delegated to that cache through
MultiTenantAwareComponent.
- Since:
- 5.4.0
- Author:
- Jan Galinski
-
Constructor Summary
ConstructorsConstructorDescriptionAggregateBasedAxonServerTenantEventStorageEngineFactory(AxonServerConnectionManager connectionManager, EventConverter defaultConverter, EventTypeResolver eventTypeResolver, @Nullable TenantComponentProvider<Converter> tenantConverterProvider) Constructs anAggregateBasedAxonServerTenantEventStorageEngineFactorybuilding per-tenant aggregate storage engines from the given components. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.engineFor(TenantDescriptor tenant) Returns theEventStorageEngineof the giventenant.registerAndStartTenant(TenantDescriptor tenantDescriptor) Registers the giventenantDescriptoras a known tenant with this multi-tenant aware component.registerTenant(TenantDescriptor tenantDescriptor) Registers the giventenantDescriptoras a known tenant with this multi-tenant aware component.
-
Constructor Details
-
AggregateBasedAxonServerTenantEventStorageEngineFactory
public AggregateBasedAxonServerTenantEventStorageEngineFactory(AxonServerConnectionManager connectionManager, EventConverter defaultConverter, EventTypeResolver eventTypeResolver, @Nullable TenantComponentProvider<Converter> tenantConverterProvider) Constructs anAggregateBasedAxonServerTenantEventStorageEngineFactorybuilding per-tenant aggregate storage engines from the given components.- Parameters:
connectionManager- the connection manager providing each tenant's Axon Server connectiondefaultConverter- the converter used when no tenant-specific converter is configuredeventTypeResolver- the resolver for the event types stored in each tenant's contexttenantConverterProvider- the optional provider of tenant-specific converters
-
-
Method Details
-
engineFor
Description copied from interface:TenantEventStorageEngineFactoryReturns theEventStorageEngineof the giventenant.- Specified by:
engineForin interfaceTenantEventStorageEngineFactory- Parameters:
tenant- the tenant to return the event storage engine for- Returns:
- the tenant's
EventStorageEngine
-
registerTenant
Description copied from interface:MultiTenantAwareComponentRegisters the giventenantDescriptoras a known tenant with this multi-tenant aware component.The caller must retain the returned
Registrationand cancel it when the tenant is removed, since releasing the component's per-tenant resources rides on that cancellation.- Specified by:
registerTenantin interfaceMultiTenantAwareComponent- Parameters:
tenantDescriptor- TheTenantDescriptorto register with this component.- Returns:
- A
Registrationused to deregister the giventenantDescriptor.
-
registerAndStartTenant
Description copied from interface:MultiTenantAwareComponentRegisters the giventenantDescriptoras a known tenant with this multi-tenant aware component. If applicable, this task will construct a tenant segment and start it.- Specified by:
registerAndStartTenantin interfaceMultiTenantAwareComponent- Parameters:
tenantDescriptor- TheTenantDescriptorto register with this component.- Returns:
- A
Registrationused to deregister the giventenantDescriptor.
-
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.
-