【发布时间】:2018-04-18 14:43:59
【问题描述】:
我想使用属性将输入和输出参数从事件中心绑定到事件中心。
在文档中只有如何使用return 语句绑定到输出的信息
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs#output---c-example
[FunctionName("EventHubOutput")]
[return: EventHub("outputEventHubMessage", Connection = "EventHubConnectionAppSetting")]
public static string Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
return $"{DateTime.Now}";
}
但我想使用ICollector<EventData> outputEventHub 作为参数来获得如下内容
[FunctionName("EventHubRewriter")]
public static void Run([EventHubTrigger("samples-workitems", Connection ="EventHubInputConnectionAppSetting")] EventData[] inputMessages, ICollector<EventData> outputMessages, TraceWriter log)
{
...
}
如何使用输出事件中心的属性生成绑定?
更新: 以下是如何为属性绑定生成 function.json 的信息:function.json generation
【问题讨论】:
标签: azure-functions azure-eventhub