At most once execution

Hello, is there a way to be sure that job was executed at most once by an external task ? Even if there was a timeout execution time.

For example, an external task fetch and lock a topic but is not able to to reach the process engine back. It’s only the complete() that wasn’t executed but all the job of the external task was done.
Process engine will consider that the task wasn’t executed but it was. Is there a way to decrement the “retry” as soon as a fetch and lock was made ? Do I miss something ?

Thanks in advance !