azure - 从 azure 函数获取标头值
问题描述
我可以使用以下方法从 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
所述阅读您的消息
using Microsoft.Azure.EventHubs;
...
public static void Run([EventHubTrigger("{EventHubName}", Connection = "EventHubConnectionAppSetting")] EventData myEventHubMessage, Binder binder, ILogger log)
推荐阅读
- r - R - plot_brmap(州界)
- operands - 无法使用 Always Encrypt 将参数化存储过程发送回 SQL Server 2016。操作数类型冲突:
- c++ - static_cast const 对 void* 的引用
- visual-c++ - Visual Studio 在遇到断点时会冻结所有线程吗?
- excel - PowerBI:使用日期/时间和信息的工具提示
- php - 我第一次发送邮件php时延迟4分钟
- ios - 为什么无法在 iOS 上恢复应用内购买?
- java - 错误:java:错误:不支持发布版本 12
- sql - 在没有唯一键的重复记录中使用填充单元格值更新空单元格
- image - 通过代码多次更改精灵后如何保持图像大小和位置?