How can I reliably handle and monitor failures in TaskQueue microflows?

0
Hello all,    I'm using TaskQueue in my Mendix app to process data asynchronously via microflows. While the setup works, I'm looking for a reliable way to handle failures and monitor task execution. Specifically: What's the best practice to catch and log errors inside a TaskQueue microflow?   Is there a standard approach to retry or re-queue failed tasks?   How can I track the status (e.g., success, failed, in-progress) of each queued task, especially when linked to a specific object?   Thanks in advance!!
asked
2 answers
4

Hi Neethu, to handle TaskQueue failures and track task execution, follow these best practices:

  1. Error Handling: Use custom error handling in your TaskQueue microflow. Catch errors using $latestError/Message and log them (e.g., via a custom log entity or LogMessage action).

  2. Retry Failed Tasks: Implement manual retry logic. Track RetryCount in a related object or control entity. If a task fails and retries < max, re-queue it uses QueueTask.

  3. Track Task Status:Create a TaskStatus entity with fields like Status (Queued, InProgress, Succeeded, Failed), StartTime, EndTime, and ErrorMessage. Update it within the TaskQueue microflow to monitor execution.

This gives you full visibility, control, and retry capability for background tasks.

Task Queue | Mendix Documentation - > Check this documentation for further helps

 

I hope this one helps you! :)

answered
2

Hi Neethu,

 

To monitor task queue you can use TaskQueueHelpers module. It will provide you all the details about task.

 

Doc: Task Queue

Module link: Task Queue Helper

 

Thanks,

Mobin

answered