With the .NET worker, we have migrated to a new binding model. In this model, no explicit Microsoft.Azure.WebJobs
references are required.
The attributes required to create Functions, Triggers, and Bindings are now available in these Nuget packages --
Microsoft.Azure.Functions.Worker.Extensions.Abstractions
Microsoft.Azure.Functions.Worker.Extensions.Http
Microsoft.Azure.Functions.Worker.Extensions.Storage
Microsoft.Azure.Functions.Worker.Extensions.Timer
Microsoft.Azure.Functions.Worker.Extensions.EventHubs
Microsoft.Azure.Functions.Worker.Extensions.EventGrid
Microsoft.Azure.Functions.Worker.Extensions.ServiceBus
Microsoft.Azure.Functions.Worker.Extensions.CosmosDB
Microsoft.Azure.Functions.Worker.Extensions.RabbitMQ
Microsoft.Azure.Functions.Worker.Extensions.SignalRService
Microsoft.Azure.Functions.Worker.Extensions.Kafka
Microsoft.Azure.Functions.Worker.Extensions.Warmup
You can find samples using all of our new binding types under samples
(link)
In the new model, we have changed how output bindings work. You can now specify output bindings in two ways:
Using Method Attributes (works if you only have one output binding)In this model, the function return value is treated as the value for the Output Binding. An example --
public static class EventHubsFunction { [Function("EventHubsFunction")] [EventHubOutput("MyEventHubName", Connection = "EventHubConnectionAppSetting")] public static string Run([EventHubTrigger("src", Connection = "EventHubConnectionAppSetting")] string input, FunctionContext context) { var logger = context.GetLogger("EventHubsFunction"); logger.LogInformation(input); var message = $"Output message created at {DateTime.Now}"; return message; } }Using Property Attributes (works with any number of output bindings)
In this model, the function return type can specify output bindings using property attributes.
/// <summary> /// This class specifies output bindings in the properties of <see cref="MyOutputType"/>. /// <see cref="MyOutputType"/> defines a Queue output binding, and an Http Response property. /// By default, a property of type <see cref="HttpResponseData"/> in the return type of the function /// is treated as an Http output binding. This property can be used to provide a response to the Http trigger. /// </summary> public static class MultiOutput { [Function("MultiOutput")] public static MyOutputType Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req, FunctionContext context) { var response = req.CreateResponse(HttpStatusCode.OK); response.WriteString("Success!"); string myQueueOutput = "some output"; return new MyOutputType() { Name = myQueueOutput, HttpReponse = response }; } } public class MyOutputType { [QueueOutput("myQueue")] public string Name { get; set; } public HttpResponseData HttpReponse { get; set; } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4