public static async Task Run()

in Hands-on lab/lab-files/src/TollBooth/TollBooth/ProcessImage.cs [38:82]


        public static async Task Run([EventGridTrigger]EventGridEvent eventGridEvent,
            [Blob(blobPath: "{data.url}", access: FileAccess.Read,
                Connection = "dataLakeConnection")] Stream incomingPlate,
            ILogger log)
        {
            var licensePlateText = string.Empty;
            // Reuse the HttpClient across calls as much as possible so as not to exhaust all available sockets on the server on which it runs.
            _client = _client ?? new HttpClient();

            try
            {
                if (incomingPlate != null)
                {
                    var createdEvent = ((JObject)eventGridEvent.Data).ToObject<StorageBlobCreatedEventData>();
                    var name = GetBlobNameFromUrl(createdEvent.Url);

                    log.LogInformation($"Processing {name}");

                    byte[] licensePlateImage;
                    // Convert the incoming image stream to a byte array.
                    using (var br = new BinaryReader(incomingPlate))
                    {
                        licensePlateImage = br.ReadBytes((int)incomingPlate.Length);
                    }

                    // TODO 1: Set the licensePlateText value by awaiting a new FindLicensePlateText.GetLicensePlate method.
                    // COMPLETE: licensePlateText = await new.....

                    // Send the details to Event Grid.
                    await new SendToEventGrid(log, _client).SendLicensePlateData(new LicensePlateData()
                    {
                        FileName = name,
                        LicensePlateText = licensePlateText,
                        TimeStamp = DateTime.UtcNow
                    });
                }
            }
            catch (Exception ex)
            {
                log.LogCritical(ex.Message);
                throw;
            }

            log.LogInformation($"Finished processing. Detected the following license plate: {licensePlateText}");
        }