如何在Visual Studio中将NotificationHub指定为Azure函数的输出触发器

时间:2017-10-25 15:38:53

标签: azure azure-functions azure-notificationhub

如何在Visual Studio for NotificationHub中为azure函数开发指定输出参数: 我的功能如下:

        [FunctionName("DoSomething")]
        public static void Run(
            [ServiceBusTrigger("myqueue", AccessRights.Manage, Connection = _Connection)]string queueItem, 
            TraceWriter log,
            [????] IAsyncCollector<Notification> notification)
        {
         //.....   
        }

azure.portal中的Azure函数具有带输出配置的json但在visual studio中的代码中它没有像NotificationHub这样的装饰器,类似于指定队列输出:[Queue("myQueueName", Connection = "myconnection")] IAsyncCollector<Notification> notification。如何定义具有门户中显示信息的输出参数?

   {
      "type": "notificationHub",
      "name": "notification",
      "hubName": "mynotification-hub",
      "connection": "CONNECTION",
      "direction": "out",
      "tagExpression": "{Tag}"
    } 

1 个答案:

答案 0 :(得分:0)

您需要安装Microsoft.Azure.WebJobs.Extensions.NotificationHubs NuGet包。

然后使用触发器

[NotificationHub] out Notification notification

[NotificationHub(HubName = "mynotification-hub", ConnectionStringSetting = "CONNECTION", 
                 TagExpression = "{Tag}")] IAsyncCollector<Notification> notification

docs中查看更多内容。