-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSampleFunction.cs
30 lines (25 loc) · 987 Bytes
/
SampleFunction.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using AISQuick.FunctionApp.Models;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;
namespace AISQuick.FunctionApp;
/// <summary>
/// Sample function that triggers on a Service Bus message and writes the message to a table.
/// </summary>
public class SampleFunction
{
private readonly ILogger<SampleFunction> _logger;
public SampleFunction(ILogger<SampleFunction> logger)
{
_logger = logger;
}
[Function(nameof(SampleFunction))]
[TableOutput("aisquickSample", Connection = "StorageAccountConnection")]
public SampleTableEntity Run(
[ServiceBusTrigger("aisquick-sample", "function-app", Connection = "ServiceBusConnection", AutoCompleteMessages = true)]
SampleMessage sampleMessage
)
{
_logger.LogInformation("Received message '{message}' with ID {id}", sampleMessage.Message, sampleMessage.Id);
return new SampleTableEntity(sampleMessage);
}
}