I would like to propose a feature that allows me to reschedule a TaskQueue execution on a new start-at momen, when dependencies are not yet available. (or other situations where a 'retry' is in place)
This would give us a clean mechanism to retry the task in a gracefull way and would greatly improve our ability to handle Event-driven integrations in Mendix in a reliable and scalable way.
We are currently working with Business Events in Mendix.
On the consuming side, we receive an Event and process it asynchronously through a TaskQueue.As part of the Event handling, we retrieve the required data from the publishing system using External Entities (OData).
The challenge we face is the following:
Some Events depend on relational data that is not yet available on the consuming side. The creation of that relational data is triggered by the processing of another Event, which may still be in progress.
As a result, we cannot reliably process the Event at hand, since the required dependent entity is missing.
At this moment, there is no way in the Mendix Modeler to reschedule a TaskQueue execution when such a dependency issue is detected. This forces us to choose between:
- Attempting to create the missing data ourselves (risking duplication, since multiple queues are processing in parallel).
- Failing the processing on purpose by throwing an Exception. This is our current 'solution', but leaves us with a cluttered Logfile.
Neither approach is desirable.
Hey Jaco, it shouldn't take too long since you're supposed to just tweak a bit the existing flow.
Just add a decision based on if the dependency object exists or not. If it doesn't exists you do nothing, if it does exist then you do what was supposed to happen. And put all this in a new scheduled event.
I think that should be it. Of course I don't know the details of your implementation but as a general idea it does sound simple enough. Please accept one of my answers if it did really help you out! ;)
You can create a Java action that schedules a microflow in the task queue with a start date. It's in the Mendix API, just not in Studio Pro.
Hi Marcian,
Your idea is not bad at all!
I've been thinking of a similar kind of solution (together with ChatGPT :D), and will probably be what i will build if it takes too long / this feature-request doesn't get enough support :)
Thanks for thinking with me :)
Kind regards,
Jaco
Hey Jaco ;)
Interesting thought indeed.
I was thinking a bit about your situation and I was wondering if you could have a simple scheduled event that runs on a periodic interval (every 5 minutes , every hour, depends on your liking) and that scheduled event could basically check if the dependency object exists or not at that moment in time. If it does things should be completed as you like if not, nothing happens and after the interval time passes it will try again basically. In this case the 'rescheduling' is just the scheduled event running again after X minutes, or Y hours.
Wouldn't this do the job? Let me know if I missed something.