我可以使用以下方法从Azure函数JS中获取标头值:
module.exports = async function (context, eventHubMessages) {
context.log(`JavaScript eventhub trigger function called for message array ${eventHubMessages}`);
const product = context.bindingData.propertiesArray[0].productFilter;
}
如何在C#的Azure函数中获取productFilter的值。
public static void Run([EventHubTrigger("{EventHubName}", Connection = "EventHubConnectionAppSetting")] string myEventHubMessage, Binder binder, ILogger log)
{
var parsedMessage = JToken.Parse(Convert.ToString(myEventHubMessage));
DeviceInfo msg = parsedMessage.ToObject<DeviceInfo>();
var deviceId = msg.deviceId;
}
答案 0 :(得分:0)
尝试像here那样以EventData
的形式阅读邮件
using Microsoft.Azure.EventHubs;
...
public static void Run([EventHubTrigger("{EventHubName}", Connection = "EventHubConnectionAppSetting")] EventData myEventHubMessage, Binder binder, ILogger log)