如何在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}"
}
答案 0 :(得分:0)
您需要安装Microsoft.Azure.WebJobs.Extensions.NotificationHubs
NuGet包。
然后使用触发器
[NotificationHub] out Notification notification
或
[NotificationHub(HubName = "mynotification-hub", ConnectionStringSetting = "CONNECTION",
TagExpression = "{Tag}")] IAsyncCollector<Notification> notification
在docs中查看更多内容。