lundi 26 septembre 2016

The specified message does not exist. ErrorCode:MessageNotFound Prod-WorkerError Context

I have a worker role which consumes messages from an Azure Queue does some processing in the background. When I check my log there appears to be no exception logged while processing the message but still in my logs I get the following Exception(pasting some of the relevant texts from the long error log only):

System.Net.WebException Microsoft.WindowsAzure.Storage.StorageException Exception messages: The remote server returned an error: (404) Not Found. The remote server returned an error: (404) Not Found. Stack Traces: at System.Net.HttpWebRequest.GetResponse() at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext) --- Next Call Stack: at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Queue.CloudQueue.DeleteMessage(String messageId, String popReceipt, QueueRequestOptions options, OperationContext operationContext) at InnovativeExams.Azure.CloudStorage.AzureQueue`1.DeleteMessage(T message) The specified message does not exist. ErrorCode:MessageNotFound Prod-WorkerError Context

Here is the code I have in the worker role:

private void ProcessQueueMessage(object queueMessageToProcess)
        {
            var queueMessage = queueMessageToProcess as EventCompletedQueueMessage;

            try
            {
                if (_eventCompletedProcessor.Process(queueMessage))
                    _azureQueue.DeleteMessage(queueMessage);
            }
            catch (Exception ex)
            {
                _logger.LogError(string.Format("Event Completed message <{0}> was not processed due to an exception", queueMessage.Id), ex, LogSources.WorkerRole_EventCompletedDispatcher);
            }
        }

The above exception is caught in the above catch block and logged.

I think there is some problem when the worker role tries to Delete the message in the Queue and the message is not found.

Need help from someone to help me resolve this error and to know the background what's going wrong here.

Aucun commentaire:

Enregistrer un commentaire