Interface MultiTenantAwareComponent
- All Superinterfaces:
DescribableComponent
- All Known Subinterfaces:
TenantComponentProvider<T>
- All Known Implementing Classes:
AggregateBasedAxonServerTenantEventStorageEngineFactory,AxonServerTenantEventStorageEngineFactory,AxonServerTenantSnapshotStoreFactory,MultiTenantAxonServerCommandBusConnector,MultiTenantAxonServerQueryBusConnector,MultiTenantEventStorageEngine,MultiTenantPersistentStreamEventSource,TenantRoutingSequencedDeadLetterQueueRegistry,TenantScopedCache
TenantProvider.
Implementations must keep nothing of a tenant whose registration throws: release whatever was allocated for it
before rethrowing, since the caller only holds the registrations that were returned. Releasing is best effort: if it
fails, attach that failure to the original one with addSuppressed and rethrow the original.
The provider's own undo is best effort as well: a cancel that itself fails can leave a resource behind. The provider logs it and attaches it to the original failure as suppressed.
A returned registration may be cancelled right after it was returned, when another component fails to register the same tenant and the tenant provider rolls the registration back. Implementers must therefore expect that a tenant they started is withdrawn again. In the window before the rollback, a component that is already live may handle a command (its events stay) or open a subscription query (the rollback ends it). At-least-once handling accepts this.
- Since:
- 4.6.0
- Author:
- Stefan Dragisic
-
Method Summary
Modifier and TypeMethodDescriptionregisterAndStartTenant(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.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Method Details
-
registerTenant
Registers 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.If this method throws, the failure rule in the interface documentation applies.
- Parameters:
tenantDescriptor- TheTenantDescriptorto register with this component.- Returns:
- A
Registrationused to deregister the giventenantDescriptor.
-
registerAndStartTenant
Registers the giventenantDescriptoras a known tenant with this multi-tenant aware component. If applicable, this task will construct a tenant segment and start it.If this method throws, the failure rule in the interface documentation applies.
- Parameters:
tenantDescriptor- TheTenantDescriptorto register with this component.- Returns:
- A
Registrationused to deregister the giventenantDescriptor.
-