DaiKeung
DaiKeung

Reputation: 1167

Docker NodeJS Azure ServiceBus Service Lock Timeout

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.

Upvotes: 0

Views: 145

Answers (1)

Itay Podhajcer
Itay Podhajcer

Reputation: 2654

You can try and use renewLockForMessage to extend the lock.

Hope it helps!

Upvotes: 1

Related Questions