infinity infinity - 5 months ago 70
C# Question

Azure WebJobs and ServiceBusTrigger

How does the poison-message handling work for Azure WebJobs SDK's

? I am looking to push the service bus queue messages that have been dequeued more than 'x' times to a different ServiceBus (or) Storage queue

The online documentation here and here and SDK Samples from here does not have examples on how the poison message handling works for ServiceBusTrigger. Is this work in progress?

I tried implementing a custom poison message handling using
parameter but it doesn't look that it is supported for ServiceBusTriggers as I was getting a runtime exception
{"Cannot bind parameter 'dequeueCount' when using this trigger."}

public static void ProcessMessage([ServiceBusTrigger(topicName: "abc", subscriptionName: "abc.gdp")] NotificationMessage message,
[Blob("rox/{PayloadId}", FileAccess.Read)] Stream blobInput, Int32 dequeueCount)
throw new ArgumentNullException();


While you cannot get the dequeueCount property for ServiceBus messages, you can always bind to BrokeredMessage instead of NotificationMessage and get the property from it.