在 Azure 服务总线规则中解析 JSON

Parsing JSON in an Azure Service Bus rule

我正在尝试在 Azure 服务总线上的订阅上添加规则。消息的有效负载如下所示:

{
  header: {
    // a bunch of data
  },
  body: {
    type: "payment",
    // a bunch of data
  }
}

使用 New-AzureRMServiceBusRule 创建新规则,当我尝试添加 "body.type = 'payment'" 时收到 400 错误。如果我只使用 "type = 'payment'" 一切都很好,但我的客户使用的标准库将所有内容强制放入其自己的信封结构中。

有没有办法在服务总线规则中解析 JSON 负载?

Azure 服务总线规则仅适用于 headers。如果您想评估 payload/body 中的内容,则必须将它们提升为 custom/user headers.

仅供参考,如果您基于相等性进行过滤,Correlation filters is much more efficient than SQL filters