Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Calling RenewLock Throws Error

$
0
0

I have a worker role using Azure Service Bus 2.4.2.0.

I'm using the "Worker Role with Service Bus Queues" which uses the event driven message pump for receiving messages off my queue.

I have a target queue setup in Azure Portal with "Lock Duration" set to 3 minutes.

Everytime I attempt to RenewLock() after 2 minutes, I am getting an exception in my LogErrors handler.  The exceptions are typically "System.TimeoutException: The request did not complete within the allotted timeout of 00:00:01:10..." I'm quite certain that my queue is set with "Lock Duration" of 3 minutes...I've double checked the Portal many times, so I'm baffled.

 Documention seems pretty thin.  I feel like I must be doing something wrong, but can't figure out what.  The code I'm using looks as follows below.

Any help would be greatly appreciated!


// WorkerRole : RoleEntryPoint Looks like this...

QueueClient _client;
readonly ManualResetEvent _completedEvent = new ManualResetEvent(false);

public override void Run()
{
    var options = new OnMessageOptions();
    options.AutoComplete = true;
    options.MaxConcurrentCalls = 1;
    options.ExceptionReceived += LogErrors;

     _client.OnMessage(OnMessageArrived, options);

    _completedEvent.WaitOne();
}


// Handler looks like this...

var stopWatch = new Stopwatch();
stopWatch.Start();

for (int i = 0; i <= maxLimit; i++)
{
    if (stopWatch.Elapsed.TotalSeconds > 120)
    {
        Trace.TraceInformation("Renewing BrokeredMessage Lock");
        brokeredMessage.RenewLock();
        stopWatch.Restart();
    }

    // Continue work...



Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>