Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Azure assembly has reference to ServiceBusTriggerAttribute?

The "How to use Azure Service Bus with the WebJobs SDK" Azure Documentation article shows the usage of [ServiceBusTrigger] attribute for integrating a WebJob and Azure Service Bus Topic messages. However, using the default Azure WebJobs project template in Visual Studio 2015, the reference to ServiceBusTrigger causes the following compile time exception:

The type or namespace name 'ServiceBusTriggger' could not be found (are you missing a using directive or an assembly reference?)

The problem at hand is the Microsoft.Azure.WebJobs package from Nuget doesn't contain the ServiceBusTriggerAttribute class.

Is there a Nuget package that can be added that will include this much needed class?

I have tried including the WindowsAzure.ServiceBus package from Nuget, but that doesn't contain it either.

Without the ServiceBusTriggerAttribute I am unable to get this WebJob connected to consume messages from an Azure Service Bus Topic. Any help would be greatly appreciated! Thanks!

like image 323
Chris Pietschmann Avatar asked Aug 04 '15 20:08

Chris Pietschmann


People also ask

What is the use of servicebustriggerattribute in Azure web jobs?

Microsoft. Azure. Web Jobs Attribute used to bind a parameter to a ServiceBus Queue message, causing the function to run when a message is enqueued. Microsoft.Azure.WebJobs.ConnectionProviderAttribute Microsoft.Azure.WebJobs.Description.BindingAttribute Attribute Usage Attribute Initializes a new instance of the ServiceBusTriggerAttribute class.

How to reference an external assembly in Azure Functions?

Referencing external assemblies in Azure Functions 1 Adding an external assembly. Let’s first create a new assembly. I am using a very complex calculation to determine the... 2 Referencing the assembly. Now for the hard part At least for me it was. I couldn’t find the right commando/keyword,... 3 More information on references. More ...

How do I add an azure function to a bin file?

Add the assembly to the BIN directory using KUDU Include the assembly and code the Azure Function to use it There is nothing overly exciting about this part, ok maybe it is exciting after all, create the Azure Function, you know the deal. I did create a Custom function, I.e. not a Timer, Data processing or Webhook + API one.

What is an azure function app?

I have previously blogged about Azure Functions and the potential of these small, stand-alone functions. It is a welcome addition to the Microsoft’s micro services vision. Function Apps are about the smallest amount of work you can do and it’s all easily exposed through an API.


3 Answers

You need to include the Microsoft.Azure.WebJobs.Extensions.ServiceBus NuGet package as mentioned in the Prereq section of this article https://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-webjobs-sdk-service-bus/#prerequisites

like image 176
pranav rastogi Avatar answered Sep 19 '22 09:09

pranav rastogi


This answer is correct for Functions 1.x, but if you are using Functions 2.x, then you need to install Microsoft.Azure.WebJobs.Extensions.ServiceBus:

Install-Package Microsoft.Azure.WebJobs.Extensions.ServiceBus

Here is the Microsoft documentation Azure Service Bus bindings for Azure Functions.

Also, make sure you reference the latest package and update any dependent packages.

like image 39
Rogala Avatar answered Sep 22 '22 09:09

Rogala


The Microsoft.Azure.WebJobs.ServiceBus package from Nuget contains the ServiceBusTriggerAttribute class.

like image 22
Chris Pietschmann Avatar answered Sep 22 '22 09:09

Chris Pietschmann