Azure函数绑定:获取EventData和强类型消息
我有下面的函数定义 消息类型:Azure函数绑定:获取EventData和强类型消息,azure,f#,azure-functions,Azure,F#,Azure Functions,我有下面的函数定义 消息类型: type MailboxItem = { CustomerID: int AssetID: int } 代码: 和function.json: { "bindings": [ { "type": "eventHubTrigger", "name": "item", "direction": "in", "path": "eventhubpath", "connection":
type MailboxItem = {
CustomerID: int
AssetID: int
}
代码:
和function.json
:
{
"bindings": [
{
"type": "eventHubTrigger",
"name": "item",
"direction": "in",
"path": "eventhubpath",
"connection": <connection>,
"consumerGroup": "$Default"
},
{
"type": "blob",
"name": "userNames",
"path": "blobpath/{CustomerID}-{AssetID}",
"connection": <connection>,
"direction": "in"
}
],
"disabled": false
}
{
“绑定”:[
{
“类型”:“eventHubTrigger”,
“名称”:“项目”,
“方向”:“在”,
“路径”:“eventhubpath”,
“联系”:,
“consumerGroup”:“$Default”
},
{
“类型”:“blob”,
“名称”:“用户名”,
“路径”:“blobpath/{CustomerID}-{AssetID}”,
“联系”:,
“方向”:“in”
}
],
“禁用”:错误
}
如您所见,我正在使用传入消息的属性从blob存储绑定输入blob
现在,我需要扩展我的函数,通过
EventData
类(例如序列号)访问传入消息的一些元数据。是否可以添加EventData
参数,但同时保留对消息正文属性的绑定?不,不幸的是,目前还没有,尽管这是一个常见的问题,我们正在回购协议中跟踪,希望很快能实现。在我们这样做之前,它是一个非此即彼-您可以绑定到EventData或您的自定义POCO
{
"bindings": [
{
"type": "eventHubTrigger",
"name": "item",
"direction": "in",
"path": "eventhubpath",
"connection": <connection>,
"consumerGroup": "$Default"
},
{
"type": "blob",
"name": "userNames",
"path": "blobpath/{CustomerID}-{AssetID}",
"connection": <connection>,
"direction": "in"
}
],
"disabled": false
}