private void LogBlobCreatedItem(BlobCreated _BlobCreated) { _logger.LogInformation($"Api: {_BlobCreated.Api}"); _logger.LogInformation($"Content Type: {_BlobCreated.ContentType}"); _logger.LogInformation($"Content Length: {_BlobCreated.ContentLength}"); _logger.LogInformation($"Url: {_BlobCreated.Url}"); }
internal async Task RunAsync() { using (Operation.Time("Retreving Item from Azure Storage Queue: {queueName} has", queueName)) { CloudStorageAccount _CloudStorageAccount = CloudStorageAccount.Parse(connectionString); CloudQueueClient _CloudQueueClient = _CloudStorageAccount.CreateCloudQueueClient(); CloudQueue _CloudQueue = _CloudQueueClient.GetQueueReference(queueName); //Verify Cloud Queue Exists using (Operation.Time("Verify Cloud Queue Exists has")) { bool _CloudQueueExists = await CloudQueueExists(_CloudQueue); if (_CloudQueueExists) { //Get Cloud Queue Message using (Operation.Time("Retrieving the Cloud Queue Message has")) { CloudQueueMessage _CloudQueueMessage = await CloudQueueGetMessageAsync(_CloudQueue); if (_CloudQueueMessage != null) { using (Operation.Time("Deserializing the Cloud Queue Message into an Event Grid Event has")) { //Deserialize Cloud Queue Message into an Event Grid Event EventGridEvent _EventGridEvent = await DeSerializeCloudQueueMessageToEventGridEvent(_CloudQueueMessage); if (_EventGridEvent != null) { //Make sure this is a BlobCreated event if (_EventGridEvent.EventType == "Microsoft.Storage.BlobCreated") { using (Operation.Time("Retrieving the Event Data from the Event Grid Event has")) { //Retrieve Event Data from Event Grid Event JObject _jObject = await DeserializeEventGridEventData(_EventGridEvent); if (_jObject != null) { using (Operation.Time("Deserializing the BlobCreated Item has")) { //Deserialize the BlobCreated Item BlobCreated _BlobCreated = await DeserializeBlobCreated(_jObject); if (_BlobCreated != null) { using (Operation.Time("Deserializing the BlobCreated Item has")) { //Log the BlobCreatedItem LogBlobCreatedItem(_BlobCreated); } } } } await _CloudQueue.DeleteMessageAsync(_CloudQueueMessage); } } } } } } } } } }