Purge notifications
Over time, the notification center table can accumulate a large number of notifications, which may impact database performance. To maintain optimal performance, you can periodically purge old notifications using the Task Scheduler cluster.
Prerequisites
- The Task Scheduler cluster must be deployed and accessible
- You need permissions to create tasks in the Task Scheduler
Creating a purge task
To purge notifications, you need to create a scheduled task that calls the RemoveAllUserNotifications server method:
- Open the Task Scheduler cluster
- Add a new task with the following settings:
- Target cluster: Select the cluster where you want to purge notifications
- Action: Call the server method
RemoveAllUserNotifications
Configuring the purge behavior
The RemoveAllUserNotifications method accepts an optional parameter to control which notifications are purged:
Default behavior (no parameters)
Without parameters, the method purges all notifications older than 7 days.
Custom retention period
To specify a custom retention period, use the maxAge parameter (in days):
{
"maxAge": 15
}
This example purges all notifications older than 15 days.
Tip
Choose a retention period based on your business requirements and database capacity.
Scheduling recommendations
Consider the following when scheduling the purge task:
- Frequency: Run the task daily or weekly, depending on notification volume
- Timing: Schedule during off-peak hours to minimize impact on users
- Monitoring: Review task execution logs to ensure successful purges
Important
Purged notifications are permanently deleted and cannot be recovered. Ensure your retention period meets business and compliance requirements before scheduling the task.
Purging notifications in Tenant Management cluster
The Tenant Management cluster also manages notifications and it is strongly recommended to set up a purge task for this cluster as well.
When creating the purge task for Tenant Management, use the following settings:
- Target cluster:
TenantManagement - Multi-tenant:
false(important: this cluster is single-tenant) - Action: Call the server method
RemoveAllUserNotifications - maxAge parameter: You can adjust the retention period according to your Tenant Management notification volume and database storage needs
Important
The Multi-tenant parameter must be set to false because the Tenant Management cluster operates in single-tenant mode, unlike your main cluster.