Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure WebJobs and ServiceBusTrigger

How does the poison-message handling work for Azure WebJobs SDK's ServiceBusTrigger ? 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 dequeueCount 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();
        }
like image 385
infinity Avatar asked Feb 02 '15 22:02

infinity


2 Answers

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.

like image 100
Victor Hurdugaci Avatar answered Sep 21 '22 15:09

Victor Hurdugaci


It looks like WebJobs handles this internally at the moment.

Reference: How to use Azure Service Bus with the WebJobs SDK

Specific section:

How ServicebusTrigger works

The SDK receives a message in PeekLock mode and calls Complete on the message if the function finishes successfully, or calls Abandon if the function fails. If the function runs longer than the PeekLock timeout, the lock is automatically renewed.

Service Bus does its own poison queue handling, so that is neither controlled by, nor configurable in, the WebJobs SDK.

Additional Reference

Poison message handling can't be controlled or configured in Azure Functions. Service Bus handles poison messages itself.

like image 23
Brendan Green Avatar answered Sep 21 '22 15:09

Brendan Green