The Azure Queue Storage output binding for Azure Functions enables you to add messages to an Azure Queue Storage queue. This binding can be used in both input and output modes. When used as an output binding, your function is triggered by a message in a queue and can then add messages to another queue. This is a powerful pattern for implementing asynchronous processing, work queues, and communication between different parts of your application.
This document focuses on the output binding scenario for queue triggers, allowing your function to write messages to a queue.
The queue trigger binding is supported in the following languages:
To configure the queue output binding, you define it in your function's function.json file (for JavaScript/TypeScript/Python) or using attributes in your code (for C#/Java).
function.json Example (JavaScript/TypeScript){
  "bindings": [
    {
      "name": "myQueueItem",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "myqueue-items",
      "connection": "AzureWebJobsStorage"
    },
    {
      "name": "outputQueueItem",
      "type": "queue",
      "direction": "out",
      "queueName": "processed-messages",
      "connection": "AzureWebJobsStorage"
    }
  ],
  "scriptFile": "index.js"
}function.json Example (Python){
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "msg",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "myqueue-items",
      "connection": "AzureWebJobsStorage"
    },
    {
      "name": "outputQueue",
      "type": "queue",
      "direction": "out",
      "queueName": "processed-messages",
      "connection": "AzureWebJobsStorage"
    }
  ]
}using Microsoft.Azure.WebJobs;
namespace MyNamespace
{
    public static class QueueTriggerAndOutput
    {
        [FunctionName("QueueTriggerAndOutput")]
        public static void Run(
            [QueueTrigger("myqueue-items", Connection = "AzureWebJobsStorage")] string myQueueItem,
            [Queue("processed-messages", Connection = "AzureWebJobsStorage")] out string outputQueueItem)
        {
            // Process myQueueItem and set outputQueueItem
            outputQueueItem = $"Processed: {myQueueItem}";
        }
    }
}import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
public class QueueTriggerAndOutput {
    @FunctionName("QueueTriggerAndOutput")
    public void run(
            @QueueTrigger(name = "myQueueItem", queueName = "myqueue-items", connection = "AzureWebJobsStorage") String myQueueItem,
            @Queue(name = "outputQueue", queueName = "processed-messages", connection = "AzureWebJobsStorage") OutputBinding<String> outputQueue,
            final ExecutionContext context) {
        context.getLogger().info("Java Queue trigger function processed: " + myQueueItem);
        outputQueue.setValue("Processed via Java: " + myQueueItem);
    }
}| Property | Description | Required | Default | 
|---|---|---|---|
| name | The name of the variable in your function code that represents the queue message. | Yes | N/A | 
| type | Must be queuefor an output binding. | Yes | N/A | 
| direction | Must be outfor an output binding. | Yes | N/A | 
| queueName | The name of the queue to write messages to. | Yes | N/A | 
| connection | The name of an app setting that contains the Azure Storage connection string. | Yes | N/A | 
Once configured, you can assign a value to the output binding variable in your function code. This value will be sent as a message to the specified output queue.
module.exports = async function (context, myQueueItem) {
    context.log('JavaScript queue trigger function processed work item', myQueueItem);
    const processedMessage = `Processed: ${myQueueItem}`;
    context.bindings.outputQueueItem = processedMessage; // Assign to the output binding name
    context.log('Sent message to output queue:', processedMessage);
};import logging
import azure.functions as func
def main(msg: func.QueueMessage, outputQueue: func.Out[str]) -> None:
    logging.info('Python queue trigger function processed a queue item: %s',
                 msg.get_body().decode('utf-8'))
    message_body = msg.get_body().decode('utf-8')
    processed_message = f"Processed: {message_body}"
    outputQueue.set(processed_message) # Set the value for the output binding
    logging.info('Sent message to output queue: %s', processed_message)context.bindings.outputQueueItem or outputQueue.set()) becomes the content of the queue message.
            connection property in your binding configuration correctly points to an app setting that holds your Azure Storage connection string.queueName property is case-insensitive for Azure Queue Storage.queueTrigger as an input binding, it receives the message content. When used as an output binding, your function writes a message to a queue. This document primarily addresses the output binding functionality.