Search code examples
azureazureservicebusazure-bicep

Azure - What causes a ServiceBus Topic to be "partitioned"


So I have a bicep file that is iterating over an array of 200+ strings, and is supposed to create a correlation filter for each string.

var strings = [ "xxx", "yyyy" ... ]

resource CorrelationFilters 'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2021-06-01-preview' = [for code in strings: {
  name: '${code}Filter' 
  parent: parentName
  properties: {
    filterType: 'CorrelationFilter'
    correlationFilter: {
      properties: {
        subscription: code
      }
    }
  }
}]

However, it is only creating a correlation filter for the first 100 elements in the array. As far as I can tell there isn't anything wrong with the bicep/code itself.

So i did some research, and see this in the Azure documentation: enter image description here

So my question is, does creating a CorrelationFilter on a topic cause it become "partitioned"? It makes sense logically, but I can't seem to find anything that indicates it does, and ChatGpt seems to think that correlation filters do not cause it to be partitioned. I'd just like to confirm if this is the culprit of the missing correlation filters or not.


Solution

  • So, my question is, does creating a Correlation Filter on a topic causes it to become "partitioned"?

    After exploring on this, I found thatCorrelation filter on a topic doesn't cause any partitioning on the topics. Here partitioning relates to the division of a topic into smaller units for operations and performance. Correlation filters would not trigger any partitioning behavior.

    Reference: Blog

    Missing filters issue might be due to following reasons:

    Few deployment tools like bicep in Azure might have limitations on the number of resources created in a single deployment.

    To check this, create an array of small string length (Eg: 20 at a time) and deploy it. If you are able to view all the filters, then it must be a limitation with bicep.

    I tried to add the correlation filters on the service bus subscriptions for a small amount of string data and it was successful as shown.

    var strings = [ 'xxx', 'yyyy', 'zzzz']
    param NamespaceName string = 'servjs'
    param TopicName string = 'latestjt'
    param subsc string = 'subscja'
    param location string = resourceGroup().location
    resource serviceBus 'Microsoft.ServiceBus/namespaces@2022-10-01-preview' = {
      name: NamespaceName
      location: location
      properties: {
      }
    }
    
    resource serviceBusTopic 'Microsoft.ServiceBus/namespaces/topics@2022-01-01-preview' = {
      parent: serviceBus
      name: TopicName
      properties: {
    
      }
    }
    resource sub 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2022-10-01-preview' = {
      name: subsc
      properties: {}
      parent: serviceBusTopic
    }
    resource CorrelationFilters 'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2021-06-01-preview' = [for code in strings: {
      name: '${code}Filter' 
      parent: sub
      properties: {
        filterType: 'CorrelationFilter'
        correlationFilter: {
          properties: {
            subscription: code
          }
        }
      }
    }]
    

    Deployment succeeded:

    enter image description here

    enter image description here