Apart from changing "Lock Duration" setting in Azure Portal, I want to know how to set the timeout value/ renew lock mechanism. (Better to handle unknown long running tasks)
var azure = require('azure-sb'),
serviceBusService = azure.createServiceBusService("Endpoint=XXX");
serviceBusService.receiveQueueMessage(MESSAGE_QUEUE_NAME, { isPeekLock: true }, function(error, lockedMessage){
... task running longer than "Lock Duration" ...
}
When finish, there is error and the message is moved to Deadletter Queue:
Error: 404 - The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue.
You can try and use renewLockForMessage to extend the lock.
Hope it helps!