public static void Run([QueueTrigger("queue-for-useragents-on-new-image-metadata", Connection = "ConnectionStrings:HR_IMAGE_QUEUE_CX")] string myQueueItem, ILogger log) { try { if (!String.IsNullOrEmpty(myQueueItem)) { log.LogInformation($"C# Queue trigger function processed original value: {myQueueItem}"); //1- var base64EncodedBytes = Convert.FromBase64String(myQueueItem); String convertedString = Encoding.UTF8.GetString(base64EncodedBytes); //2- log.LogInformation($"C# Queue trigger function processed converted value: {convertedString}"); HRSubmitPictureListItemDto data = JsonConvert.DeserializeObject <HRSubmitPictureListItemDto>(convertedString); //3- String endpoint = Environment.GetEnvironmentVariable(ENV_NEW_IMAGE_SIGNALR_ENDPOINT_KEY); log.LogInformation("Endpoint : " + endpoint); HRUtils.NotifyPutBackend <HRSubmitPictureListItemDto>(data, endpoint, log); log.LogInformation("HRNewImageMetadataForUserAgents ended successfully."); } else { log.LogInformation("HRNewImageMetadataForUserAgents dummy on null entry."); } } catch (Exception ex) { log.LogError("HRNewImageMetadataForUserAgents exception : " + ex.Message); } }
public static void Run([QueueTrigger("hr-main-new-image", Connection = "ConnectionStrings:HR_IMAGE_QUEUE_CX")] string myQueueItem, ILogger log) { //BONNE PRATIQUE TOUJLURS ENCADRE DE TRY CATH POUR S'Y RETROUVER DANS LES LOGS AZURE try { if (!String.IsNullOrEmpty(myQueueItem)) { //1 var base64EncodedBytes = Convert.FromBase64String(myQueueItem); String convertedString = Encoding.UTF8.GetString(base64EncodedBytes); HRSubmitPictureListItemDto data = JsonConvert.DeserializeObject <HRSubmitPictureListItemDto>(convertedString); String url = data?.FullImageUrl; if (!String.IsNullOrEmpty(url)) { log.LogInformation($"Data received : " + convertedString); //2- String blobPath = CreateAndUploadThumbnail(url, log); data.ThumbnailUrl = blobPath; //3- string backEndPoint = Environment.GetEnvironmentVariable(ENV_UPDATE_THUMBNAIL_ENDPOINT); HRUtils.NotifyPutBackend <HRSubmitPictureListItemDto>(data, backEndPoint, log); log.LogInformation($"Step 2: " + blobPath); //4- string userAgentsEndPoint = Environment.GetEnvironmentVariable(ENV_NEW_THUMBNAIL_SIGNALR_ENDPOINT_KEY); HRUtils.NotifyPutBackend <HRSubmitPictureListItemDto>(data, userAgentsEndPoint, log); log.LogInformation($"Step 3 : " + blobPath); } else { log.LogInformation($"No Fullimage URL supplied, can not process thumbnail."); } } else { log.LogInformation($"Empty entry"); } } catch (Exception ex) { log.LogInformation($"HR Error !!! : " + ex.Message); } }