@Marko Bozic The default behavior is peek-lock itself, but it is tied to the successful execution of your function. If the function succeeds, the message is completed and otherwise is tried until the configured maxRetries
value in host.json.
In C#, you can bind to the MessageReceiver
instance but unfortunately this isn't possible for non-C# languages. Even if you were to build the receiver instance, you can't complete/abandon the message since the lock token isn't available to the function.
The workaround here would be to instead create a new message for failures into a different queue to schedule work for the future. This is like what dead lettering looks like except that you would use a queue managed by you instead of the dead letter sub queue.
Also, there is this issue that tracks this but hasn't seen any traction.