Open aivinog1 opened 1 year ago
@aivinog1 interesting. Thank you for raising it. :+1:
What do you think about adding an optional number of invocations to the completeTask()
command? Similar to your first option.
If the number is set to x
, it completes a job of this type x
times at max. If no number is set, it completes all available jobs.
It could look like this:
completeTask(jobType = "updateStatus", invocations = 1)
throwError(jobType = "updateStatus", errorCode = "updateStatusError")
completeTask(jobType = "doSmthngWithErr")
What do you think about adding an optional number of invocations to the
completeTask()
command? Similar to your first option.
Hey, @saig0!
Thank you for your solution, but I think that we should not complete jobs x
times at max, but activate them. Otherwise, there could be a case where a worker that already completes jobs x
times constantly tries to activate such jobs, do nothing and the broker makes them activable again, and in the worst case scenario this could be infinitely repeated as I already described here:
Add some sort of matcher or selector for completeTask. Again, as I can see this could be not 100% fixed, because in the worst case scenario, all jobs will be executed by one worker, which will never complete the job (and it will be reactivated again, but could be taken again by the "wrong" worker).
Good point.
But I think about replacing the job worker for completing a job with a simple complete job command. By only using the complete command, we could avoid issues with job activation.
Describe the bug For example, I have such a process:
serviceTasksWithSameTypeAndErrorHandling.bpmn.zip
If I will test a happy path, it is pretty easy:
But if I will decide to test an error path I will get a flaky test because the job in the element with error handling could be activated by the worker from
completeTask
orthrowError
:To Reproduce Steps to reproduce the behavior:
Expected behavior I expect that a such test will never be flaky.
Additional context I see the 3 options that we have to fix it:
completeTask
. Again, as I can see this could be not 100% fixed, because in the worst case scenario, all jobs will be executed by one worker, which will never complete the job (and it will be reactivated again, but could be taken again by the "wrong" worker).JobClient
instead of using the Zeebe Worker. For example, as soon ascompleteJob
calling we create a singleActivateJobs
command with exactly one job. And complete it via theCompleteJob
command. In this case, we could get a situation when a job is not ready for activation, but theActivateJobs
request already came.So, as you can see I can't find a good solution, maybe you can vote/help me, @saig0? š