Azure 函数使用 nodejs 获取服务总线 brokeredMessage

Azure functions get service bus brokeredMessage with nodejs

有没有办法从 javascript azure 函数中检索服务总线中转消息。 此时只有一个包含 invocationId 的上下文,而不是所有属性,如 brokeredProperties 或 customPropeties。

谢谢

目前无法通过节点函数执行此操作。您必须使用 C# 并指定 BrokeredMessage 作为您的参数类型,在这种情况下,您将获得整个消息来处理自己。

已提交问题以公开服务总线(和事件中心)触发器的更多详细信息:https://github.com/Azure/azure-webjobs-sdk/issues/1004。我在这个问题中添加了 link,这样我们就可以确保在解决问题时考虑了您的情况。

现在,所有服务总线自定义属性都在 context.bindingData.properties 对象中可用。

就我而言:

properties: 
{ 
    type: 'sometype',   // <- this is the property I have set manually in IoT Device-to-Cloud message
    'iothub-connection-device-id': 'mydeviceid',
    'iothub-connection-auth-method': '{"scope":"somescope","type":"sometype","issuer":"external","acceptingIpFilterRule":null}',
    'iothub-connection-auth-generation-id': 'someid' // <- These are added by IoT Hub
}