如何定义 EventHub 输出?
How to define EventHub output?
我有一个 Azure 函数(使用 VS 2017 预览版中新的预编译函数支持)处理来自事件中心的输入触发器,如下所示:
[FunctionName("ProcessSensorDataFromDevices")]
public static void Run(
[EventHubTrigger("sensordata-ingest", Connection = "SensorDataEventHubConnection")]string sensorDataEventHubMessage,
[EventHub("rdx-ingest", Connection = "RdxDataEventHubConnection")]out string rdxEventHubMessage,
TraceWriter log)
{
SensorData sensorData = Newtonsoft.Json.JsonConvert.DeserializeObject<SensorData>(sensorDataEventHubMessage);
// Push the sensor data to the RDX Event Hub
rdxEventHubMessage = sensorDataEventHubMessage;
log.Info($"C# Event Hub trigger function processed a message: {sensorDataEventHubMessage}");
}
我认为输出的定义应该类似于输入,但似乎还需要一些其他技巧。
我没有遇到任何编译时错误,但在调试器中尝试 运行 我的函数时出现此错误:
[6/9/2017 9:44:37 PM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
[6/9/2017 9:44:37 PM] Job host started
[6/9/2017 9:44:37 PM] The following 1 functions are in error:
[6/9/2017 9:44:37 PM] ProcessSensorDataFromDevices: Value cannot be null.
[6/9/2017 9:44:37 PM] Parameter name: eventHubName.
如果我删除处理 rdxEventHubMessage 的两行代码,那么一切正常。
正确定义 EventHub 输出需要什么?
Microsoft.NET.Sdk.Functions Nuget 包中存在错误。将其更新到 1.0.0-alpha6 版本(2017 年 6 月 9 日星期五发布)解决了这个问题。
我有一个 Azure 函数(使用 VS 2017 预览版中新的预编译函数支持)处理来自事件中心的输入触发器,如下所示:
[FunctionName("ProcessSensorDataFromDevices")]
public static void Run(
[EventHubTrigger("sensordata-ingest", Connection = "SensorDataEventHubConnection")]string sensorDataEventHubMessage,
[EventHub("rdx-ingest", Connection = "RdxDataEventHubConnection")]out string rdxEventHubMessage,
TraceWriter log)
{
SensorData sensorData = Newtonsoft.Json.JsonConvert.DeserializeObject<SensorData>(sensorDataEventHubMessage);
// Push the sensor data to the RDX Event Hub
rdxEventHubMessage = sensorDataEventHubMessage;
log.Info($"C# Event Hub trigger function processed a message: {sensorDataEventHubMessage}");
}
我认为输出的定义应该类似于输入,但似乎还需要一些其他技巧。
我没有遇到任何编译时错误,但在调试器中尝试 运行 我的函数时出现此错误:
[6/9/2017 9:44:37 PM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
[6/9/2017 9:44:37 PM] Job host started
[6/9/2017 9:44:37 PM] The following 1 functions are in error:
[6/9/2017 9:44:37 PM] ProcessSensorDataFromDevices: Value cannot be null.
[6/9/2017 9:44:37 PM] Parameter name: eventHubName.
如果我删除处理 rdxEventHubMessage 的两行代码,那么一切正常。
正确定义 EventHub 输出需要什么?
Microsoft.NET.Sdk.Functions Nuget 包中存在错误。将其更新到 1.0.0-alpha6 版本(2017 年 6 月 9 日星期五发布)解决了这个问题。