Skip to content

Commit 74fef22

Browse files
committed
updates
1 parent f72a2d9 commit 74fef22

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

AzureServiceBusToSQL.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<FrameworkReference Include="Microsoft.AspNetCore.App" />
1010
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
1111
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.1.0" />
12+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.EventGrid" Version="3.5.0" />
1213
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
1314
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.2" />
1415
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.20.0" />

Filedroptrigger.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Default URL for triggering event grid function in the local environment.
2+
// http://localhost:7071/runtime/webhooks/EventGrid?functionName={functionname}
3+
4+
using System;
5+
using System.IO;
6+
using System.Text.Json;
7+
using Azure.Messaging;
8+
using Azure.Messaging.EventGrid;
9+
using Azure.Storage.Blobs;
10+
using Microsoft.Azure.Functions.Worker;
11+
using Microsoft.Extensions.Logging;
12+
using Xenhey.BPM.Core.Net8.Implementation;
13+
using Xenhey.BPM.Core.Net8;
14+
using Microsoft.Graph.Models;
15+
using Newtonsoft.Json;
16+
using System.Collections.Specialized;
17+
using Microsoft.Azure.Management.Sql.Fluent.Models;
18+
19+
namespace AzureServiceBusToSQL;
20+
21+
public class Filedroptrigger
22+
{
23+
private readonly ILogger<Filedroptrigger> _logger;
24+
private NameValueCollection nvc = new NameValueCollection();
25+
26+
public Filedroptrigger(ILogger<Filedroptrigger> logger)
27+
{
28+
_logger = logger;
29+
}
30+
31+
[Function(nameof(Filedroptrigger))]
32+
public void Run([EventGridTrigger] EventGridEvent eventGridEvent)
33+
{
34+
string ApiKeyName = "x-api-key";
35+
_logger.LogInformation($"Received event: {eventGridEvent.EventType}");
36+
37+
if (eventGridEvent.EventType != "Microsoft.Storage.BlobCreated")
38+
{
39+
_logger.LogWarning("Event is not a BlobCreated event. Skipping.");
40+
return;
41+
}
42+
NameValueCollection nvc = new NameValueCollection
43+
{
44+
{ ApiKeyName, "2484F9382E974133A216F8E39BF4C389" }
45+
};
46+
var input = JsonConvert.SerializeObject(eventGridEvent);
47+
IOrchestrationService orchrestatorService = new RemoteOrchrestratorService(nvc);
48+
var processFiles = orchrestatorService.Run(input);
49+
50+
51+
52+
}
53+
}

0 commit comments

Comments
 (0)