Storage Queue Bindings
Azure Functions can read from and write to Azure Storage Queues using input and output bindings. This page provides an overview, configuration details, and sample code for C#, JavaScript, and Python.
Binding Types
- QueueTrigger – Executes the function when a new message arrives.
- Queue input binding – Retrieves a message without triggering the function.
- Queue output binding – Sends a message to a queue as part of function execution.
Function.json Template
{
"bindings": [
{
"type": "queueTrigger",
"direction": "in",
"name": "myQueueItem",
"queueName": "myqueue-items",
"connection": "AzureWebJobsStorage"
},
{
"type": "queue",
"direction": "out",
"name": "outputQueue",
"queueName": "myoutput-queue",
"connection": "AzureWebJobsStorage"
}
]
}
Code Samples
C#
JavaScript
Python
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
public static class QueueProcessor
{
[FunctionName("QueueProcessor")]
public static void Run(
[QueueTrigger("myqueue-items", Connection = "AzureWebJobsStorage")] string myQueueItem,
[Queue("myoutput-queue", Connection = "AzureWebJobsStorage")] out string outputQueue,
ILogger log)
{
log.LogInformation($"C# Queue trigger processed: {myQueueItem}");
outputQueue = $"Processed: {myQueueItem}";
}
}
Local Development Settings
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}