Camunda 7 external task not working properly

We are using camunda external task spring boot client in 7.18, I am looking for some guidance on configuring timing properties for external tasks as sometime the external tasks pick up work very fast and sometimes they would wait before start processing work.

The current problem is I have a spring boot function running under a transaction, this call asynchronously completes a camunda task via rest api which make a new external task available to be picked up, so sometimes this new external tasks gets picked up and comepleted even before the original method running under transaction is complete and external task subscriber uses the data inserted by the transactional method. Which means subscriber gets inconsistent/incorrect data as the transaction method is not complete yet.

How can I get around this problem ?

I want some sort of behavior where subscriber will wait for few seconds and allow transactions to complete before it can start processing work. Can I configure some properties to control the behavior of external task subscribers for my requirement ?

Please advise. thanks

I think there is some misunderstand in this topic. Camunda external worker complete method not only completes current task, but also works as “borrowed job executor” thread and moves process token to next transaction point.
Which in the case is next external worker task.
You can always set async after flag on first task to complete fast and close transaction, then let job executor move process token to new task.

But, it is not required most of the cases. Complete method returns 200with some network delay after reaching next transaction point. New worker can get new task even faster than compete gets reply. But it doesnt mean that “transaction is incomplete”.

Common use case is setup async before flag on every external task