Hello,
You can add your custom microflow logic as follows :
Retrive Processed Queue Task List from database, by adding respected QueueTaskStatus constraint and delete the list accordingly
Hi Chaitanya,
Is there a built-in cleanup?
Not for these statuses. The runtime cleanup (com.mendix.core.ProcessedTasksCleanupAge and com.mendix.core.ProcessedTasksCleanupBatchSize) removes only Completed records from System.ProcessedQueueTask. Failed, Aborted and Incompatible records stay until you remove them yourself.
Recommended approach: a custom cleanup
Create a scheduled event that runs a microflow which:
Retrieves System.ProcessedQueueTask objects where Status is Failed, Aborted or Incompatible and the record is older than your retention period (for example 30 days, based on Finished).
Deletes them in batches (for example 1,000 at a time, looping until none are left) to avoid long transactions and memory problems.
Runs outside business hours.
The Task Queue Helpers module from the Marketplace also has maintenance microflows you can reuse.
What to check before deleting
Failed: the task hit an error and won’t be retried, so that work was never done. Check the ErrorMessage and rerun or fix the data first.
Incompatible: the task never ran, because the microflow was renamed or removed, or its parameters changed after the task was queued. Confirm the work isn’t still needed.
Aborted: usually safe to delete. These are history entries created when a node went down, and the task itself was retried on another node.
Only delete from ProcessedQueueTask. Never delete from or write to System.QueuedTask, because that holds tasks that are still waiting or running.
If you need the records for auditing, export or archive them before deleting.
Hope this helps! If this solution works for you, kindly mark it as the accepted answer so it can help others facing the same issue.
Hi Chaitanya,
In addition to a Scheduled Event cleanup, it is worth monitoring the database growth caused by System.ProcessedQueueTask, especially in production environments with high task volumes.
From a database perspective:
Large numbers of Failed, Aborted, and Incompatible records can increase table size and affect query performance when administrators review task history.
If the table grows into millions of records, database maintenance operations such as backups, statistics updates, and index scans may take longer.
A periodic cleanup strategy (for example, retaining only the last 30-90 days of non-completed tasks) helps keep the table manageable.
For on-premise or self-managed databases (PostgreSQL, SQL Server, etc.), after substantial deletions you may also need normal database maintenance activities such as:
PostgreSQL: VACUUM / VACUUM ANALYZE
SQL Server: Index rebuild/reorganize and statistics updates
However, I would still recommend performing the deletion through Mendix (microflow or scheduled event) rather than executing direct SQL DELETE statements against Mendix system tables, since direct database changes are not officially supported and bypass runtime consistency checks.
A practical approach is:
Retain recent Failed/Incompatible records for troubleshooting.
Archive important error details if required.
Delete old records via a Scheduled Event in batches.
Include the table in regular database maintenance reviews if task volume is high.
This helps prevent unnecessary growth of the System.ProcessedQueueTask table while keeping enough history available for support and root-cause analysis.
Hi Chaithanya,
Mendix's built-in Task Queue cleanup only removes System.ProcessedQueueTask records with the Completed status.
The runtime setting com.mendix.core.ProcessedTasksCleanupAge does not automatically clean up Failed, Aborted, or Incompatible records.
For these statuses, I recommend implementing a separate, controlled cleanup process.
Failed: The task ended with an exception and will not be retried automatically.
Aborted: The task was interrupted, typically because a runtime node stopped. Mendix records the aborted attempt and schedules the task for retry.
Incompatible: The task could not execute because its microflow, parameters, or Task Queue configuration became incompatible with the current application model.
These records are useful for troubleshooting and should not be removed immediately.
Create an administrator-only microflow, for example:
ADM_CleanupProcessedQueueTasks
Retrieve records from System.ProcessedQueueTask using an XPath constraint similar to:
[Status = 'Failed'
or Status = 'Aborted'
or Status = 'Incompatible']Apply an additional date constraint based on your retention policy, using an appropriate available date attribute.
For example, retain non-completed records for 30 or 90 days.
Avoid deleting thousands of records in a single transaction.
Instead:
Retrieve a limited batch of eligible records.
Review or archive relevant error details.
Delete the selected System.ProcessedQueueTask objects.
Commit the transaction.
Continue with the next batch until the cleanup limit is reached.
Start with a small batch size, such as 100–500 records, and monitor database performance.
Once tested, execute the cleanup microflow through a Scheduled Event or Task Queue at a suitable interval.
For production environments, I recommend running cleanup during off-peak hours.
Do not directly delete or modify records in System.QueuedTask. This table is managed by the Mendix Runtime and contains active or pending tasks.
Deleting a Failed record does not retry the failed operation.
Deleting an Incompatible record does not restore or execute the original task.
Preserve important error information before deleting records.
Ensure that the cleanup does not interfere with application-specific monitoring, audit, or reconciliation processes.
Recommended retention strategy:
Status | Recommended handling |
|---|---|
Completed | Built-in cleanup |
Failed | Investigate, archive, then delete |
Aborted | Retain for retry diagnostics, then delete |
Incompatible | Investigate deployment compatibility, then delete |
Conclusion:
Use the built-in runtime setting for Completed tasks and a custom retention-based cleanup microflow for Failed, Aborted, and Incompatible System.ProcessedQueueTask records.
There is no documented built-in runtime setting that automatically cleans up these three non-completed statuses.
Official documentation:
https://docs.mendix.com/refguide/task-queue/
Hope this helps! If you find this answer helpful, please mark it as the accepted answer.
Hi Chaitanya,
These task queue should be handled using custom flows, based up on the weightage the task carry can you decide if it has to be deleted or should go for a retry. Cross check the task with the business logic to find the weightage of the task
Feel free to ask your queries!!