Class AxonServerMultiTenancyConfigurationDefaults
- All Implemented Interfaces:
ConfigurationEnhancer
ConfigurationEnhancer registering the default Axon Server-backed multi-tenancy components:
- the
TenantProviderwhich is responsible for managing tenants and lifecycle, backed byAxonServerTenantProvider - the
MultiTenantAxonServerCommandBusConnectorwhich fans out commands to a connector per tenant - the
MultiTenantEventStorageEngineas theEventStorageEngine, routing appends and sourcing to each tenant's own engine, and theMultiTenantSnapshotStoreas theSnapshotStore, routing snapshot writes the same way - the
TenantEventStorageEngineFactoryandTenantSnapshotStoreFactorybuilding those per-tenant components against the tenant's Axon Server context - the
MultiTenantAxonServerQueryBusConnectorwhich fans out queries to a connector per tenant
SnapshotSourcingConfigurationEnhancer, since snapshot sourcing is composed per tenant by
the routing engine rather than once for the application.
Contributed through the ServiceLoader, so multi-tenancy is active as soon as the
axoniq-multi-tenancy module is on the classpath. Use
MultiTenancyUtils.disable(ComponentRegistry) to opt out, for instance
when running against an infrastructure without Axon Server.
- Since:
- 5.3.0
- Author:
- Jan Galinski, Laura Devriendt, Jakob Hatzl
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe order ofthisenhancer compared to others. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentDefinition<TenantProvider> Provides aComponentDefinitionfor theTenantProviderthat is backed by Axon Server.voidenhance(ComponentRegistry componentRegistry) intorder()Returns the relative order this enhancer should be invoked in, compared to other instances.
-
Field Details
-
ENHANCER_ORDER
public static final int ENHANCER_ORDERThe order ofthisenhancer compared to others.Runs early, so the Axon Server-backed multi-tenancy defaults registered here are in place before other enhancers and user registrations that build on them, most notably before Axon Server's own
AxonServerConfigurationEnhancerregisters its non-multi-tenant defaults for the same component types.Expressed relative to
MultiTenancyConfigurationDefaults.ENHANCER_ORDER, which anchors the multi-tenancy enhancer block, so this enhancer can never end up ahead of the generic defaults it builds on.- See Also:
-
-
Constructor Details
-
AxonServerMultiTenancyConfigurationDefaults
public AxonServerMultiTenancyConfigurationDefaults()
-
-
Method Details
-
order
public int order()Description copied from interface:ConfigurationEnhancerReturns 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
0when not set.- Specified by:
orderin interfaceConfigurationEnhancer- Returns:
- The order in which this enhancer should be invoked.
-
enhance
Description copied from interface:ConfigurationEnhancer- Specified by:
enhancein interfaceConfigurationEnhancer- Parameters:
componentRegistry- The registry instance to enhance.
-
axonServerTenantProvider
Provides aComponentDefinitionfor theTenantProviderthat is backed by Axon Server. Uses theAxonServerConnectionManagerto manage connections and theTenantConnectPredicateto determine which tenants to connect to, defaults toAxonServerTenantConnectPredicate.- Returns:
- a
ComponentDefinitionfor theTenantProviderthat is backed by Axon Server
-