我可以使用以下方法从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;
}
尝试阅读你的消息,如EventData
提到的here
using Microsoft.Azure.EventHubs;
...
public static void Run([EventHubTrigger("{EventHubName}", Connection = "EventHubConnectionAppSetting")] EventData myEventHubMessage, Binder binder, ILogger log)