Stéphane FICO
Stéphane FICO

Reputation: 13

Azure functions get service bus brokeredMessage with nodejs

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

Upvotes: 1

Views: 1061

Answers (2)

Paweł Skorupiński
Paweł Skorupiński

Reputation: 501

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
}

Upvotes: 2

brettsam
brettsam

Reputation: 2792

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.

Upvotes: 1

Related Questions