从azure函数中获取标题值

问题描述 投票:0回答:1

我可以使用以下方法从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;
    }
azure azure-functions azure-eventhub
1个回答
0
投票

尝试阅读你的消息,如EventData提到的here

using Microsoft.Azure.EventHubs;
...

    public static void Run([EventHubTrigger("{EventHubName}", Connection = "EventHubConnectionAppSetting")] EventData myEventHubMessage, Binder binder, ILogger log)
© www.soinside.com 2019 - 2024. All rights reserved.