* Introduce `TenantDeleted` event to handle tenant cleanup Added a `TenantDeleted` event to differentiate between tenant deactivation and deletion. Updated event handlers and services to support unregistering resources only during tenant deletion, ensuring clearer separation of responsibilities. Included ADR documentation for the new event. * Remove unnecessary blank line in tenant deactivation logic
1.3 KiB
1.3 KiB
5. Tenant Deleted Event
Date: 2025-08-05
Status
Accepted
Context
As outlined in issue #6661, there is a need to differentiate between Tenant Deactivating and Tenant Deleting events.
Currently, the TenantDeactivated event is used to unregister timer-based triggers. However, this causes the triggers to be unregistered when the application host shuts down, which is not the desired behavior. Instead, we want the triggers to remain registered until the tenant is explicitly deleted.
Decision
To address this, we will introduce a new event called TenantDeleted. This event will be raised when a tenant is deleted and will be responsible for unregistering timer-based triggers. This ensures that the triggers remain active until the tenant is explicitly deleted.
Consequences
- Timer-based triggers will no longer be unregistered during tenant deactivation. Instead, they will remain active until the tenant is deleted.
- The
TenantDeactivatedevent will continue to be used for deactivating tenants without affecting the registration of timer-based triggers. - The new
TenantDeletedevent will specifically handle the cleanup of resources associated with a tenant when it is deleted, ensuring a clear separation of responsibilities.