通过azure功能在azure服务总线中发送完整的代理消息 [英] send a full brokered message in azure service bus from an azure function

查看:55
本文介绍了通过azure功能在azure服务总线中发送完整的代理消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临在JavaScript的azure函数中向azure服务总线输出发送完整的代理消息的问题. 该文档仅显示一条简单的正文消息 https://docs.microsoft.com/zh-CN/azure/azure-functions/functions-bindings-service-bus 而没有任何customerProperties.

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);

推荐答案

不幸的是,这是节点的局限性之一,因为我们丢失了一些C#中的类型信息.

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

您可能试图发送带有自定义属性的bodytest的消息,但是您也可能尝试以body子属性的形式发送整个对象作为主体. Azure Functions假定您返回的所有内容都应进入主体.

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:

  • 放弃输出绑定,并直接将 ServiceBus sdk用于节点
  • 使用C#或F#代替实际的BrokeredMessage类型
  • 让您的node函数将结果放入队列,然后触发C#函数创建您想要的确切BrokeredMessage
  • 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

这篇关于通过azure功能在azure服务总线中发送完整的代理消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆