Azure存储队列的绑定参数

时间:2018-04-15 20:15:40

标签: c# azure azure-functions azure-queues

我按照以下教程使用Azure Functions将消息添加到队列。

https://docs.microsoft.com/en-us/azure/azure-functions/functions-integrate-storage-queue-output-binding#add-code-that-uses-the-output-binding

当我使用Azure Web门户创建该功能时,它工作正常。现在我正在使用Visual Studio。我很困惑如何将队列参数添加到我的函数定义中。

[FunctionName("PublishMessage")]
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequest req,
    <<<<<<<<<<<<TODO: What to add here>>>>>>>>>>> ICollector<string> outputQueueItem,
    TraceWriter log)
{
    log.Info("C# HTTP trigger function processed a request.");

这是来自function.json文件的参数(我需要添加到我的函数中),

{
  "type": "queue",
  "name": "outputQueueItem",
  "queueName": "outqueue",
  "connection": "AzureWebJobsDashboard",
  "direction": "out"
}

1 个答案:

答案 0 :(得分:1)

应该像

一样简单
[Queue("outqueue", Connection="AzureWebJobsDashboard")] ICollector<string> outputQueueItem