通过azure功能在azure服务总线中发送完整的代理消息

编程入门 行业动态 更新时间:2024-10-10 14:28:49
本文介绍了通过azure功能在azure服务总线中发送完整的代理消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我面临在JavaScript的azure函数中向azure服务总线输出发送完整的代理消息的问题. 该文档仅显示一条简单的正文消息 docs.microsoft/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 docs.microsoft/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#.

您可能试图发送带有自定义属性的body为test的消息,但是您也可能尝试以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服务总线中发送完整的代理消息

本文发布于:2023-11-14 06:11:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586444.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:总线   完整   消息   功能   azure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!