Reputation: 11501
I am trying to handle my message poisoning by it doesn't hit my poison method. I am following this article from Microsoft and this is my code:
public static void ProcessQueueMessage([ServiceBusTrigger("emailqueue")] EmailModels.EmailSendModel message, TextWriter log,[SendGrid()] out Mail mail)
{
log.WriteLine(message);
mail = new Mail(){Subject = message.Title};
mail.From = new Email("[email protected]");
mail.AddPersonalization(new Personalization()
{Tos= message.To.Select(t=>new Email (t.Email)).ToList()});
mail.AddContent(new Content("text/plain", $"The message {message.Body}' was successfully processed."));
}
public static void ProcessPoisonMessage([ServiceBusTrigger("emailqueue-poison")] EmailModels.EmailSendModel message, TextWriter logger)
{
logger.WriteLine($"start poisoning");
logger.WriteLine($"Poisoning message for proposal id {message.ProposalId} for list {JsonConvert.SerializeObject(message.To)}");
}
The send method gets hit 5 time and fails (intentionally) but then the poisoning doesn't get hit and my message ends up in the dead-letter messages without any action :|
What am I doing wrong?
Upvotes: 0
Views: 143
Reputation: 35134
The article you quoted is describing Azure Storage Queues, not Service Bus. They are distinct services, and poison message handling is quite different.
Try marking your trigger with
[ServiceBusTrigger("emailqueue/$DeadLetterQueue")]
Upvotes: 1