如何使用二头肌创建多个主题的规则来创建多个订阅?

发布于 2025-01-26 14:01:17 字数 1316 浏览 5 评论 0原文

我的目标是创建具有多个订阅的多个主题,并且每个订阅都有其自己的规则(在这种情况下为SQLFILTER)。 以下解决方案不起作用,使以下例外: *内部错误-System.NotimplementEdexception:在数组访问索引表达式重写期间,索引表达式计数与无法访问的符号之间的不匹配。 我是使用命名空间规则完全错误还是缺少什​​么? NotimplementedException确实使我感到困惑。 我正在使用二头肌版本0.6.1。我还没有测试过旧版本的二头肌,但肯定会这样做。

param topics array = [
  'customerevents'
  'ekonomievents'
  'orderevents'
]

var customerSubs = json(loadTextContent('./objects/customerSubscriptions.json'))

param parentResource string

resource servicebusNamespace 'Microsoft.ServiceBus/namespaces@2021-11-01' existing = {
  name: parentResource
}

resource topicResource 'Microsoft.ServiceBus/namespaces/topics@2021-11-01' = [for topic in topics : {
  name: topic
  parent: servicebusNamespace
  }]
  
resource subscriptionCustomer 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2021-11-01' = [for (subscription, i) in customerSubs : {
  name: subscription.name
  dependsOn: topicResource
  parent: topicResource[0]
}]

resource subscriptionCustomerRules 'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2021-11-01' = [for (subscription, i) in customerSubs : {
  name: uniqueString(subscription.name)
  parent: subscriptionCustomer[i]
  properties:{
    filterType:'SqlFilter'
    sqlFilter: {
      sqlExpression: '1=1'
      requiresPreprocessing: false
    }
  }
}]

My goal here is to create multiple topics with multiple subscriptions and every subscription has its own rule(an sqlfilter in this case).
The below solution which doesn't work renders this exception:
*Internal Error - System.NotImplementedException: Mismatch between count of index expressions and inaccessible symbols during array access index expression rewriting.
Am I using the namespace rule totally wrong or what am I missing? The NotImplementedException really makes it all confusing to me.
I'm using Bicep version 0.6.1. I have not tested an older version of bicep yet but will definitely do so.

param topics array = [
  'customerevents'
  'ekonomievents'
  'orderevents'
]

var customerSubs = json(loadTextContent('./objects/customerSubscriptions.json'))

param parentResource string

resource servicebusNamespace 'Microsoft.ServiceBus/namespaces@2021-11-01' existing = {
  name: parentResource
}

resource topicResource 'Microsoft.ServiceBus/namespaces/topics@2021-11-01' = [for topic in topics : {
  name: topic
  parent: servicebusNamespace
  }]
  
resource subscriptionCustomer 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2021-11-01' = [for (subscription, i) in customerSubs : {
  name: subscription.name
  dependsOn: topicResource
  parent: topicResource[0]
}]

resource subscriptionCustomerRules 'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2021-11-01' = [for (subscription, i) in customerSubs : {
  name: uniqueString(subscription.name)
  parent: subscriptionCustomer[i]
  properties:{
    filterType:'SqlFilter'
    sqlFilter: {
      sqlExpression: '1=1'
      requiresPreprocessing: false
    }
  }
}]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文