4
votes

I'm facing issue to send a complete brokered message to an azure service bus output in azure function in javascript. The documentation only show a simple body message https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus without any customerProperties.

My attempts to create a full brokered message failed so far, everything goes into the body.

enter image description here enter image description here

var message = {'body' : 'test', 'customProperties' : {'fromsystem':'sap'}};
context.bindings.outputSbMsg = message;
context.done(null, res);
1

1 Answers

3
votes

Unfortunately this is one of the limitations of node, as we lose some type information that we have in C#.

You could be trying to send a message with a body of test with custom properties, but you could also be trying to send the entire object as the body, with a body sub-property. Azure Functions make the assumption that everything that you return should go into the body.

As a workaround, you could:

  • ditch the output binding and use the ServiceBus sdk for node directly
  • instead of node, use C# or F# with the actual BrokeredMessage type
  • have your node function put the result into a queue, which then triggers a C# function to create the exact BrokeredMessage you want