【问题标题】:How can you set the MessageId of a Service Bus message using the Azure Functions output binding?如何使用 Azure Functions 输出绑定设置服务总线消息的 MessageId?
【发布时间】:2018-01-11 22:33:26
【问题描述】:

如何使用 Azure Functions 输出绑定设置服务总线消息的 MessageId?

我已经在我的预编译 C# 函数应用程序中使用以下输出绑定将函数写入 SB 主题...

[ServiceBus("targettopic", Connection = "SbConnectionString")]
    out PersonEvent outPerson,

但我需要设置 MessageId 以在重复检测历史记录中使用

【问题讨论】:

    标签: c# azure azure-functions azureservicebus


    【解决方案1】:

    您必须返回BrokeredMessage 类型的实例,而不是您的自定义类。这将使您能够设置任何属性,包括消息 ID。

    【讨论】:

    • 老鼠...我有这样的想法。是的,这是一种享受,但现在任何订阅者都必须将正文作为 BrokeredMessage 处理:-(
    • 不一定。您只需要完全按照订阅者的期望对正文进行编码
    • 知道如何处理 javascript azure 函数吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-28
    • 2019-10-15
    • 1970-01-01
    • 2021-11-30
    相关资源
    最近更新 更多