Azure Service Bus with nodejs: get messages from queue extremely slow
<p>This is callback for handling incoming messges from queue:</p>

<pre><code>function startListen(){
    serviceBusService.receiveQueueMessage(queueForRequest, {isPeekLock:true},
    function(error, lockedMessage) { handleMessage(error, lockedMessage)} );
}

function handleMessage(err, msg){
    if(typeof msg !== "undefined"){ //if msg has been received, delete it
    serviceBusService.deleteMessage(msg, function(deleteError){
        if(deleteError) console.log('Can not delete message');
    });  
  } 

    if (!err){
    var result = ProcessMessage(msg);
    sendResponse(result);
    }
    else{console.log(err);}

    startListen(); //try get message again
}
</code></pre>

<p>Such code works bad. Sometimes the server can get messages from queue, however very often <code>HandleMessage()</code> has err as argument:</p>

<blockquote>
  <p>No message to receive</p>
</blockquote>

<p>Finally some messages stays unprocessed. It works good at the start of listening therefore I think the issue hides in my code. What's wrong?</p>