I have an Azure website with several queued features. SDK documentation at https://docs.microsoft.com/en-us/azure/app-service-web/websites-dotnet-webjobs-sdk-storage-queues-how-to#config defines the MaxDequeueCount
property as:
The maximum number of attempts before a queue message is sent to the queue poison (default is 5).
but I do not see such behavior. In my weblog I have:
JobHostConfiguration config = new JobHostConfiguration(); config.Queues.MaxDequeueCount = 1; JobHost host = new JobHost(config); host.RunAndBlock();
and then I have a function with a running queue in which I throw an exception:
public void ProcessQueueMessage([QueueTrigger("azurewejobtestingqueue")] string item, TextWriter logger) { if ( item == "exception" ) { throw new Exception(); } }
Looking at the webjobs toolbar, I see that the SDK makes 5 attempts (the default is 5):
![Webjob Errors Displayed on the webjobs Toolbar](https://fooobar.com//img/7ad37bd2494fec3826c6566c017bbc3b.png)
and after the 5th attempt, the message moves to the poison queue. I expect to see 1 repeat (or no attempts?) Not 5.
UPDATE: Detailed logging is enabled for the web application and the option to save these logs to the Azure blob container is selected. Found several logs related to my problem located in the azure-jobs-host-archive
container. Here's an example showing an element with a decompression number of 96:
{ "Type": "FunctionCompleted", "EndTime": "2017-02-22T00:07:40.8133081+00:00", "Failure": { "ExceptionType": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException", "ExceptionDetails": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: ItemProcessor.ProcessQueueMessage ---> MyApp.Exceptions.MySpecialAppExceptionType: Exception of type 'MyApp.Exceptions.MySpecialAppExceptionType' was thrown. }, "ParameterLogs": {}, "FunctionInstanceId": "1ffac7b0-1290-4343-8ee1-2af0d39ae2c9", "Function": { "Id": "MyApp.Processors.ItemProcessor.ProcessQueueMessage", "FullName": "MyApp.Processors.ItemProcessor.ProcessQueueMessage", "ShortName": "ItemProcessor.ProcessQueueMessage", "Parameters": [ { "Type": "QueueTrigger", "AccountName": "MyStorageAccount", "QueueName": "stuff-processor", "Name": "sourceFeedItemQueueItem" }, { "Type": "BindingData", "Name": "dequeueCount" }, { "Type": "ParameterDescriptor", "Name": "logger" } ] }, "Arguments": { "sourceFeedItemQueueItem": "{\"SourceFeedUpdateID\":437530,\"PodcastFeedID\":\"2d48D2sf2\"}", "dequeueCount": "96", "logger": null }, "Reason": "AutomaticTrigger", "ReasonDetails": "New queue message detected on 'stuff-processor'.", "StartTime": "2017-02-22T00:07:40.6017341+00:00", "OutputBlob": { "ContainerName": "azure-webjobs-hosts", "BlobName": "output-logs/1ffd3c7b012c043438ed12af0d39ae2c9.txt" }, "ParameterLogBlob": { "ContainerName": "azure-webjobs-hosts", "BlobName": "output-logs/1cf2c1b012sa0d3438ee12daf0d39ae2c9.params.txt" }, "LogLevel": "Info", "HostInstanceId": "d1825bdb-d92a-4657-81a4-36253e01ea5e", "HostDisplayName": "ItemProcessor", "SharedQueueName": "azure-webjobs-host-490daea03c70316f8aa2509438afe8ef", "InstanceQueueName": "azure-webjobs-host-d18252sdbd92a4657d1a436253e01ea5e", "Heartbeat": { "SharedContainerName": "azure-webjobs-hosts", "SharedDirectoryName": "heartbeats/490baea03cfdfd0416f8aa25aqr438afe8ef", "InstanceBlobName": "zd1825bdbdsdgga465781a436q53e01ea5e", "ExpirationInSeconds": 45 }, "WebJobRunIdentifier": { "WebSiteName": "myappengine", "JobType": "Continuous", "JobName": "ItemProcessor", "RunId": "" } }
What I'm still looking for is logs that show me the details for a particular queue element, where processing succeeds (and therefore is removed from the queue) or fails due to an exception and is put in the poison queue. I still have not found any magazines showing this detail. Log files referenced by the above output do not contain this type of data.
UPDATE 2: Looked at the state of my poisonous lineup, and it looks like it might be a smoking gun, but I'm too tight to put 2 and 2 together. Looking at the screenshot of the queue below, you can see the message with the identifier (left column) 431210
there many times. The fact that it appears several times tells me that the message in the original queue does not work correctly.
![Poison queue](https://fooobar.com/undefined)