天蓝色函数服务总线输出消息属性
azure function service bus output message properties
我正在尝试使用服务总线绑定输出在 JavaScript Azure 函数中设置服务总线消息的元数据。不幸的是,绑定似乎只支持正文。
查看文档,我看到您可以通过 context.bindingData
在服务总线触发器中访问此信息,但我没有看到任何相应的服务总线输出接口。
有什么方法可以发送完整的代理消息并设置消息属性 (ContentType) 和消息自定义属性?
在 https://github.com/Azure/Azure-Functions/issues/454
上有一个未解决的问题
一些客户似乎找到了解决方法。也许你可以试试他们这里提到的方法 https://github.com/Azure/Azure-Functions/issues/454#issuecomment-375154151
@l--''''''--------'''''''''''' 您需要访问 Microsoft.Azure.ServiceBus.Message
class.假设您有一些 json 称为 messageBody
并且您有一些要添加到消息中的属性列表。您可以像下面的例子一样实现它。
确保添加 using Microsoft.Azure.ServiceBus;
var myCustomProperties = new List<Dictionary<string,string>>();
var message = new Message(Encoding.UTF8.GetBytes(messageBody));
foreach (var userProperty in myCustomProperties)
{
message.UserProperties.Add(userProperty.Key, userProperty.Value);
}
我正在尝试使用服务总线绑定输出在 JavaScript Azure 函数中设置服务总线消息的元数据。不幸的是,绑定似乎只支持正文。
查看文档,我看到您可以通过 context.bindingData
在服务总线触发器中访问此信息,但我没有看到任何相应的服务总线输出接口。
有什么方法可以发送完整的代理消息并设置消息属性 (ContentType) 和消息自定义属性?
在 https://github.com/Azure/Azure-Functions/issues/454
上有一个未解决的问题一些客户似乎找到了解决方法。也许你可以试试他们这里提到的方法 https://github.com/Azure/Azure-Functions/issues/454#issuecomment-375154151
@l--''''''--------'''''''''''' 您需要访问 Microsoft.Azure.ServiceBus.Message
class.假设您有一些 json 称为 messageBody
并且您有一些要添加到消息中的属性列表。您可以像下面的例子一样实现它。
确保添加 using Microsoft.Azure.ServiceBus;
var myCustomProperties = new List<Dictionary<string,string>>();
var message = new Message(Encoding.UTF8.GetBytes(messageBody));
foreach (var userProperty in myCustomProperties)
{
message.UserProperties.Add(userProperty.Key, userProperty.Value);
}