Example 1:

Display queue message.

        [FunctionName("QueueTriggerExample")]
        public static void Run([QueueTrigger("myqueue01", Connection = "MyConnectionString")]string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
        }

Example 2:

Place queue item in Blob container.

        [FunctionName("RequestQuote")]
        public static void Run([QueueTrigger("quote-request-new", Connection = "MyConnectionString")] string myQueueItem, 
            [Blob("quote-request-processed/{rand-guid}.json")] out string acceptedQueueItem,
            [Blob("quote-request-rejected/{rand-guid}.json")] out string rejectedQueueItem, 
            ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");

            acceptedQueueItem = JsonConvert.SerializeObject(myQueueItem);
            rejectedQueueItem = null;
        }

Sources:

https://www.c-sharpcorner.com/article/blob-triggers-and-queue-storage-trigger-azure-functions/

Last modified: April 2, 2021

Author

Comments

Write a Reply or Comment