Posts

Showing posts from April, 2020

Duplicate Detection for Service Bus output binding in Azure Functions

Here's a way to get the Azure Service Bus output binding for your Azure Function working after you've enabled Duplicate Detection (or other features) on the Service Bus queue or topic. If you haven't had duplicate detection turned on or haven't been using some of the other Azure Service Bus features, you might set up the output binding in your Azure Functions so you can send a custom class object to a Service Bus queue or topic. Something like the following. [FunctionName("MyFunction1")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, [ServiceBus("%MyQueueName%", Connection = "MyServiceBusConnection")] IAsyncCollector<MyItem> myOutputQueue) {     var myItem = new MyItem();     // Do stuff.     // . . .     // Add the item to the queue.     await myOutputQueue.AddAsync(myItem);     // Do more stuff.     // . . .     return new OkResult();