Table of Contents

TAureliusTenantCatalog Class

Non-visual component providing the tenant catalog (tenant-to-shard routing, shard registry, identifier mappings) together with its routing cache and provisioner.

Remarks

By default the catalog is stored in the database reached through the Connection component. Use the OnGetCatalog event to plug any other ITenantCatalog implementation (for example, a client to a remote catalog service) while keeping the caching and provisioning behavior.

Syntax

Unit: Aurelius.Comp.TenantCatalog

TAureliusTenantCatalog = class(TComponent);

Constructors

Name Description
Create Creates a new TAureliusTenantCatalog instance.

Methods

Name Description
ActivateTenant Sets the status of a tenant to Active.
AddTenant Registers a tenant in the catalog if it does not exist yet, allocating a shard and running the provisioning event.
DisableTenant Sets the status of a tenant to Disabled, blocking its requests immediately.
FindTenantBy​Identifier Returns the tenant associated with an external identifier, using the routing cache.
GetCache Returns the routing cache over the catalog, creating it on first access.
GetCatalog Returns the ITenantCatalog in use, creating it on first access.
GetProvisioner Returns the tenant provisioner over the catalog, creating it on first access.
InvalidateAll Drops all cached routing information.
InvalidateIdentifier Drops the cached mapping of an external identifier, so the next lookup re-reads the catalog.
InvalidateTenant Drops the cached routing information of a tenant, so the next request re-reads the catalog.
MoveTenantToShard Points a tenant to another shard.
ReleaseCatalog Releases the current catalog, cache and provisioner instances; they are recreated on next access.
RemoveIdentifier Removes an external identifier. Nothing happens if the identifier is unknown.
SaveIdentifier Associates an external identifier (an API client id, a custom domain, a user id) with a tenant, replacing any previous association of the same identifier.
SuspendTenant Sets the status of a tenant to Suspended, blocking its requests immediately.
UpdateCatalogSchema Creates or updates the catalog tables in the catalog database.

Properties

Name Description
Allocator Gets or sets the shard allocation strategy used by AddTenant when no shard id is given.
CacheTTL Gets or sets the time, in milliseconds, for which routing information read from the catalog is cached.
Connection The connection pool component that reaches the catalog database, used by the default database-backed catalog.
NegativeCacheTTL Gets or sets the time, in milliseconds, for which unknown tenant ids are cached, so repeated requests for nonexistent tenants do not flood the catalog.

Events

Name Description
OnAllocateShard Fired by AddTenant after the allocator has chosen a shard for a new tenant, allowing the handler to override the choice.
OnGetCatalog Fired when the catalog implementation is needed for the first time, allowing a custom ITenantCatalog to replace the default database-backed one.
OnProvisionShard Fired by AddTenant when the tenant's shard has no catalog record yet, before the tenant itself is provisioned.
OnProvisionTenant Fired by AddTenant while provisioning a tenant (new or still pending).