在Azure函数Python SDK中,如何获取给定命名空间的主题数?

问题描述

我正在将Python 3.8与azure-mgmt-servicebus = 1.0.0一起使用。我想获取给定名称空间的主题数。我已经尝试了以下...

credential = ServicePrincipalCredentials(self._client_id, self._client_secret, tenant=self._tenant)
        sb_client = ServiceBusManagementClient(credential, self._subscription)
         ...
        topics = sb_client.topics.list_by_namespace(
                resource_group_name=self._resource_group_name,                namespace_name=namespace
            )
            num_topics = 0
            while topics.current_page:
                num_topics += topics.current_page.count
                topics.next
            logging.info("num topics: %s", num_topics)

尽管我已验证建立了连接(我可以创建具有相同连接的主题),并且在Azure门户中可以看到许多给定信息的主题,但我的“ num_topics”始终返回零。我以为我没有正确使用API​​,但不确定哪里会崩溃。如何获得给定名称空间的主题数?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)