1

I have Azure function like below -

[FunctionName("Demo")]
        public static void Run([ServiceBusTrigger("%Demo-Queue%", Connection = "AzureWebJobsBPGAServiceBus")]string myQueueItem,
             [ServiceBus("%Update-Queue%", Connection = "AzureWebJobsBPGAServiceBus")] ICollector<BrokeredMessage> updateMessage,
            TraceWriter log)
        {
            string query = "SELECT Id FROM MyTable";

            var data = dbs.GetData(query).GetAwaiter().GetResult();

            BrokeredMessage brokeredMessage;
            foreach (var item in data)
            {
                JObject jObject = new JObject(new JProperty("Id", item), new JProperty("MessageId", new Guid(item)));
                brokeredMessage = new BrokeredMessage(jObject.ToString());
                updateMessage.Add(brokeredMessage);
            }
        }

But message going in dead letter queue . why ? Message format is also correct.Any clue ?

2 Answers 2

2

If a message is moved to dead-letter Queue, the reason may be one of these. There will be two custom properties added to the dead-letter messages, when it is moved to dead-letter Queue (DeadLetterReason and DeadLetterErrorDescription), try reading those properties to find the reason.

Sign up to request clarification or add additional context in comments.

7 Comments

it only say "Max delivery count exceeded " and "Message could not be consumed after 10 delivery attempts"
If a message is received more times than the value set to Max Delivery Count, the message can no longer be received. The delivery count of the message increases when the message is received with lock context.
the problem is only with particular queue i tried to delete and re-create that queue with same name still same problem why ? when i create new queue with different name it works ..
it shows max delivery count for dead letter queue message is 11 but why when i delete and re-create then it should work right ?
It should work after recreating the Queue. I am not sure why it is not working :(
|
0

Your Function is being triggered by messages in your Demo-Queue and the message(s) myQueueItem was/were dispatched to your Function Demo at least 10 times before being moved to the dead-letter queue. Failing >=10 times means that your Function execution did not succeed for >= 10 times.

Kindly search your Function Logs to see if there are any error messages to indicate why your Function execution did not succeed, e.g. due to timeout or errors in your Function code. If it's due to timeout, you may change the autoRenewTimeout property in your host.json to see if that will resolve the issue.

Note that if you are on consumption plan, the autoRenewTimeout needs to stay within the constraints of the max execution time of 5 mins (default) or the configured functionTimeout property (honored to max of 10 mins) in your host.json file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.