在ARM模板中定义时未应用Azure Service Bus筛选器 [英] Azure Service Bus Filter Not Applied When Defined in ARM Template

查看:62
本文介绍了在ARM模板中定义时未应用Azure Service Bus筛选器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面定义了一个ARM模板的片段,该片段创建了服务总线主题,订阅和规则/过滤器.该规则与主题和订阅一起应用,但是过滤器的值为1 = 1.为什么不应用该表达式?

I have defined below a fragment of an ARM template which creates a service bus topic, subscription, and rule/filter. The rule is applied along with the topic and subscription, but the value of the filter is 1=1. Why would the expression not be applied?

{
    "apiVersion": "2017-04-01",
    "name": "[concat(parameters('serviceBusNamespaceName'), '/TOPIC-NAME')]",
    "type": "Microsoft.ServiceBus/namespaces/topics",
    "location": "[variables('location')]",
    "dependsOn": [
        "[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"
    ],
    "properties": {
        "path": "TOPIC-NAME",
        "duplicateDetectionHistoryTimeWindow": "00:10:00",
        "enableBatchedOperations": false,
        "enablePartitioning": true,
        "enableSubscriptionPartitioning": false,
        "filteringMessagesBeforePublishing": false,
        "maxSizeInMegabytes": 5120
    },
    "resources": [
        {
            "apiVersion": "2017-04-01",
            "name": "SUB-NAME",
            "type": "subscriptions",
            "dependsOn": [
                "[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'), '/topics/TOPIC-NAME')]"
            ],
            "properties": {},
            "resources": [
                {
                    "apiVersion": "2017-04-01",
                    "name": "SUB-NAME",
                    "type": "Rules",
                    "dependsOn": [
                        "[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'), '/topics/TOPIC-NAME/subscriptions/SUB-NAME')]"
                    ],
                    "properties": {
                        "filter": {
                            "sqlExpression": "MessageType = 'TYPE-OF-MESSAGE' AND MajorVersion = 1"
                        },
                        "action": {
                            "sqlExpression": "SET sys.Label='TYPE-OF-MESSAGE'"
                        }
                    }
                }
            ]
        }
    ]
}

推荐答案

您的订阅规则应定义如下:

Your subscription rule should be defined as follows:

"resources": [
                {
                  "apiVersion": "2017-04-01",
                  "name": "SUB-NAME-FILTER",
                  "type": "Rules",
                  "dependsOn": [
                    "[parameters('serviceBusSubscriptionName')]"
                  ],
                  "properties": {
                    "filterType": "SqlFilter",
                    "sqlFilter": {
                      "sqlExpression": "MessageType = 'TYPE-OF-MESSAGE' AND MajorVersion = 1"
                      "requiresPreprocessing": "false"
                    },
                    "action": {
                        "sqlExpression": "SET sys.Label='TYPE-OF-MESSAGE'"
                    }
                  }
                }
              ]

这篇关于在ARM模板中定义时未应用Azure Service Bus筛选器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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