send a full brokered message in azure service bus from an azure function

陌路散爱 提交于 2019-12-12 16:26:51

问题


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.

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

回答1:


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


来源:https://stackoverflow.com/questions/42117135/send-a-full-brokered-message-in-azure-service-bus-from-an-azure-function

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