Azure functions get service bus brokeredMessage with nodejs

守給你的承諾、 提交于 2019-12-11 06:32:09

问题


Is there a way to retrieve the service bus brokered message from a javascript azure function. At this time there's only a context that containing an invocationId, but not all properties like brokeredProperties or customPropeties.

Thanks


回答1:


There currently is no way to do this from node functions. You'd have to use C# and specify a BrokeredMessage as your parameter type, in which case you'd be given the entire message to handle yourself.

There is an issue filed to expose more details for Service Bus (and Event Hub) triggers: https://github.com/Azure/azure-webjobs-sdk/issues/1004. I've added a link to this question so we can make sure we've taken your scenario into account when we address it.




回答2:


Right now, all of the Service Bus custom properties are available in context.bindingData.properties object.

In my case:

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
}


来源:https://stackoverflow.com/questions/42385995/azure-functions-get-service-bus-brokeredmessage-with-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!