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