【发布时间】:2022-08-23 13:44:39
【问题描述】:
我有一个用 NodeJS 构建的 Azure 函数,它在 HTTP 触发器上接收数据,处理数据,然后必须将处理后的数据输出到 Azure 事件中心,以便在 Azure ADX 中摄取。输出数据是 JSON 格式的有效负载。
流动:
AZ 函数(HTTP 触发器)-> AZ 事件中心-> AZ ADX使用 EventHubProducerClient 类(来自 NPM @azure/event-hubs),我能够将数据发布到事件中心,然后将其链接到 ADX 并摄取数据。 (如果您构建应用服务,这通常是遵循的方法)。
我想利用烘烤的Azure 函数绑定对于 eventHub(使用
Microsoft.Azure.Functions.ExtensionBundle),我已经设置了设置:{ \"bindings\": [ { \"authLevel\": \"function\", \"type\": \"httpTrigger\", \"direction\": \"in\", \"name\": \"req\", \"methods\": [\"post\"], \"route\": \"upload\" }, { \"type\": \"http\", \"direction\": \"out\", \"name\": \"res\" }, { \"type\": \"eventHub\", \"name\": \"outputEventHub\", \"eventHubName\": \"%AZEH_EVENTHUB_NAME%\", \"connection\": \"AZEH_CONNECTION_STRING\", \"direction\": \"out\" } }我一直在尝试在绑定中找到有关 dataType 属性的文档(在 function.json 中设置),但我能找到的最好的文档是指定支持的类型的文档,但没有说明如何实现它。我看到的最好的是设置
\"dataType\": \"string\"支持的类型列表:
- Azure.Messaging.EventHubs.EventData
- 字符串
- 字节数组
- 普通旧 CLR 对象 (POCO)
在我处理触发器的函数中,我将上下文绑定设置为 JSON 数据,例如:
context.bindings.outputEventHub = jsonData;但数据无法通过 ADX。
有人对如何设置 AZ 函数以通过事件中心将数据摄取到 ADX 有一些参考吗?
标签: azure azure-functions azure-eventhub