你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
ServiceBusAdministrationClient 类
使用此客户端创建、更新、列出和删除 ServiceBus 命名空间的资源。
- 继承
-
builtins.objectServiceBusAdministrationClient
构造函数
ServiceBusAdministrationClient(fully_qualified_namespace: str, credential: TokenCredential, *, api_version: str | ApiVersion = ApiVersion.V2021_05, **kwargs: Any)
参数
- credential
- <xref:TokenCredential>
进行身份验证以管理 ServiceBus 命名空间的实体。
- api_version
- str 或 ApiVersion
用于请求的服务总线 API 版本。 默认值是与当前 SDK 兼容的最新服务版本。 设置为较旧版本可能会导致功能兼容性降低。
方法
close | |
create_queue |
创建队列。 |
create_rule |
为主题订阅创建规则。 |
create_subscription |
创建主题订阅。 |
create_topic |
创建主题。 |
delete_queue |
删除队列。 |
delete_rule |
删除主题订阅规则。 |
delete_subscription |
删除主题订阅。 |
delete_topic |
删除主题。 |
from_connection_string |
从连接字符串创建客户端。 |
get_namespace_properties |
获取命名空间属性 |
get_queue |
获取队列的属性。 |
get_queue_runtime_properties |
获取队列的运行时信息。 |
get_rule |
获取主题订阅规则的属性。 |
get_subscription |
获取主题订阅的属性。 |
get_subscription_runtime_properties |
获取主题订阅运行时信息。 |
get_topic |
获取主题的属性。 |
get_topic_runtime_properties |
获取主题的运行时信息。 |
list_queues |
列出 ServiceBus 命名空间的队列。 |
list_queues_runtime_properties |
列出 ServiceBus 命名空间中队列的运行时信息。 |
list_rules |
列出主题订阅的规则。 |
list_subscriptions |
列出 ServiceBus 主题的订阅。 |
list_subscriptions_runtime_properties |
列出 ServiceBus 主题的订阅运行时信息。 |
list_topics |
列出 ServiceBus 命名空间的主题。 |
list_topics_runtime_properties |
列出 ServiceBus 命名空间的主题运行时信息。 |
update_queue |
更新队列。 在调用此方法之前,应使用 get_queue、 create_queue 或 list_queues 来获取 QueueProperties 实例,然后更新属性。 只能更新部分属性。 请参阅 https://docs.microsoft.com/en-us/rest/api/servicebus/update-queue 。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 QueueProperties 实例中指定的任何属性。 有关属性的名称,请参阅 ~azure.servicebus.management.QueueProperties。 |
update_rule |
更新规则。 在调用此方法之前,应使用 get_rule、 create_rule 或 list_rules 来获取 RuleProperties 实例,然后更新属性。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 RuleProperties 实例中指定的任何属性。 有关属性的名称,请参阅 ~azure.servicebus.management.RuleProperties。 |
update_subscription |
更新订阅。 在调用此方法之前,应使用 get_subscription、 update_subscription 或 list_subscription 来获取 SubscriptionProperties 实例,然后更新属性。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 SubscriptionProperties 实例中指定的任何内容。 有关属性的名称,请参阅 ~azure.servicebus.management.SubscriptionProperties。 |
update_topic |
更新主题。 在调用此方法之前,应使用 get_topic、 create_topic 或 list_topics 来获取 TopicProperties 实例,然后更新属性。 只能更新部分属性。 请参阅 https://docs.microsoft.com/en-us/rest/api/servicebus/update-topic 。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 TopicProperties 实例中指定的任何内容。 有关属性的名称,请参阅 ~azure.servicebus.management.TopicProperties。 |
close
close() -> None
create_queue
创建队列。
create_queue(queue_name: str, *, authorization_rules: List[AuthorizationRule] | None = None, auto_delete_on_idle: timedelta | str | None = None, dead_lettering_on_message_expiration: bool | None = None, default_message_time_to_live: timedelta | str | None = None, duplicate_detection_history_time_window: timedelta | str | None = None, enable_batched_operations: bool | None = None, enable_express: bool | None = None, enable_partitioning: bool | None = None, lock_duration: timedelta | str | None = None, max_delivery_count: int | None = None, max_size_in_megabytes: int | None = None, requires_duplicate_detection: bool | None = None, requires_session: bool | None = None, forward_to: str | None = None, user_metadata: str | None = None, forward_dead_lettered_messages_to: str | None = None, max_message_size_in_kilobytes: int | None = None, **kwargs: Any) -> QueueProperties
参数
- authorization_rules
- list[AuthorizationRule]
资源的授权规则。
ISO 8601 timeSpan 空闲间隔,在此间隔后自动删除队列。 最短持续时间为 5 分钟。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- dead_lettering_on_message_expiration
- bool
一个 值,该值指示消息过期时此队列是否支持死信。
ISO 8601 默认消息时间跨度到实时值。 这是消息过期的持续时间,从消息发送到服务总线时开始。 这是未在消息本身上设置 TimeToLive 时使用的默认值。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
定义重复检测历史记录持续时间的 ISO 8601 timeSpan 结构。 默认值为 10 分钟。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- enable_batched_operations
- bool
指示是否启用服务器端批处理操作的值。
- enable_express
- bool
一个 值,该值指示是否启用快速实体。 在将消息写入持久存储之前,快速队列暂时将消息保留在内存中。
- enable_partitioning
- bool
一个 值,该值指示是否要在多个消息中转站之间对队列进行分区。
ISO 8601 速览锁的次数跨度持续时间;也就是说,消息为其他接收方锁定的时间量。 LockDuration 的最大值为 5 分钟;默认值为 1 分钟。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- max_delivery_count
- int
最大传递计数。 传递次数达到此数字后,自动将消息视为死信。 默认值为 10。
- max_size_in_megabytes
- int
队列的最大大小(以 MB 为单位),即为队列分配的内存大小。
- requires_duplicate_detection
- bool
一个 值,该值指示此队列是否需要重复检测。
- requires_session
- bool
一个 值,该值指示队列是否支持会话的概念。
- forward_to
- str
发送到队列的所有消息都转发到的收件人实体的名称。
- user_metadata
- str
用户可以与说明关联的自定义 metdata。 最大长度为 1024 个字符。
- forward_dead_lettered_messages_to
- str
此订阅的所有死信消息都转发到的收件人实体的名称。
- max_message_size_in_kilobytes
- int
队列可以接受的消息有效负载的最大大小(以 KB 为单位)。 仅当使用高级命名空间和服务总线 API 版本“2021-05”或更高版本时,此功能才可用。 允许的最小值为 1024,而允许的最大值为 102400。 默认值为 1024。
返回类型
create_rule
为主题订阅创建规则。
create_rule(topic_name: str, subscription_name: str, rule_name: str, *, filter: ~azure.servicebus.management._models.CorrelationRuleFilter | ~azure.servicebus.management._models.SqlRuleFilter = <azure.servicebus.management._models.TrueRuleFilter object>, action: ~azure.servicebus.management._models.SqlRuleAction | None = None, **kwargs: ~typing.Any) -> RuleProperties
参数
- filter
- Union[CorrelationRuleFilter, SqlRuleFilter]
规则的筛选器。 默认值为 ~azure.servicebus.management.TrueRuleFilter
- action
- Optional[SqlRuleAction]
规则的操作。
返回类型
create_subscription
创建主题订阅。
create_subscription(topic_name: str, subscription_name: str, *, lock_duration: timedelta | str | None = None, requires_session: bool | None = None, default_message_time_to_live: timedelta | str | None = None, dead_lettering_on_message_expiration: bool | None = None, dead_lettering_on_filter_evaluation_exceptions: bool | None = None, max_delivery_count: int | None = None, enable_batched_operations: bool | None = None, forward_to: str | None = None, user_metadata: str | None = None, forward_dead_lettered_messages_to: str | None = None, auto_delete_on_idle: timedelta | str | None = None, **kwargs: Any) -> SubscriptionProperties
参数
ISO 8601 速览锁的次数跨度持续时间;也就是说,消息为其他接收方锁定的时间量。 LockDuration 的最大值为 5 分钟;默认值为 1 分钟。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- requires_session
- bool
一个 值,该值指示队列是否支持会话的概念。
ISO 8601 默认消息时间跨度到实时值。 这是消息过期的持续时间,从消息发送到服务总线时开始。 这是未在消息本身上设置 TimeToLive 时使用的默认值。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- dead_lettering_on_message_expiration
- bool
一个 值,该值指示消息过期时此订阅是否具有死信支持。
- dead_lettering_on_filter_evaluation_exceptions
- bool
一个 值,该值指示消息过期时此订阅是否具有死信支持。
- max_delivery_count
- int
最大传递计数。 传递次数达到此数字后,自动将消息视为死信。 默认值为 10。
- enable_batched_operations
- bool
指示是否启用服务器端批处理操作的值。
- forward_to
- str
发送到订阅的所有消息将转发到的收件人实体的名称。
- user_metadata
- str
与订阅关联的元数据。 最多包含 1024 个字符。
- forward_dead_lettered_messages_to
- str
发送到订阅的所有消息将转发到的收件人实体的名称。
ISO 8601 timeSpan 空闲间隔,在此间隔后自动删除订阅。 最短持续时间为 5 分钟。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
返回类型
create_topic
创建主题。
create_topic(topic_name: str, *, default_message_time_to_live: timedelta | str | None = None, max_size_in_megabytes: int | None = None, requires_duplicate_detection: bool | None = None, duplicate_detection_history_time_window: timedelta | str | None = None, enable_batched_operations: bool | None = None, size_in_bytes: int | None = None, filtering_messages_before_publishing: bool | None = None, authorization_rules: List[AuthorizationRule] | None = None, support_ordering: bool | None = None, auto_delete_on_idle: timedelta | str | None = None, enable_partitioning: bool | None = None, enable_express: bool | None = None, user_metadata: str | None = None, max_message_size_in_kilobytes: int | None = None, **kwargs: Any) -> TopicProperties
参数
ISO 8601 默认消息时间跨度到实时值。 这是消息过期的持续时间,从消息发送到服务总线时开始。 这是未在消息本身上设置 TimeToLive 时使用的默认值。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- max_size_in_megabytes
- int
主题的最大大小(以 MB 为单位),即为主题分配的内存大小。
- requires_duplicate_detection
- bool
一个 值,该值指示本主题是否需要重复检测。
定义重复检测历史记录持续时间的 ISO 8601 timeSpan 结构。 默认值为 10 分钟。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- enable_batched_operations
- bool
指示是否启用服务器端批处理操作的值。
- size_in_bytes
- int
主题的大小(以字节为单位)。
- filtering_messages_before_publishing
- bool
在发布之前筛选消息。
- authorization_rules
- list[AuthorizationRule]
资源的授权规则。
- support_ordering
- bool
一个 值,该值指示主题是否支持排序。
ISO 8601 timeSpan 空闲间隔,在此间隔后将自动删除主题。 最短持续时间为 5 分钟。 接受类型为 ~datetime.timedelta 或 ISO 8601 持续时间格式的字符串(如“PT300S”)的输入值。
- enable_partitioning
- bool
一个 值,该值指示是否要在多个消息中转站之间对主题进行分区。
- enable_express
- bool
一个 值,该值指示是否启用快速实体。 在将消息写入持久存储之前,快速队列暂时将消息保留在内存中。
- user_metadata
- str
与主题关联的元数据。
- max_message_size_in_kilobytes
- int
队列可以接受的消息有效负载的最大大小(以 KB 为单位)。 仅当使用高级命名空间和服务总线 API 版本“2021-05”或更高版本时,此功能才可用。 允许的最小值为 1024,而允许的最大值为 102400。 默认值为 1024。
返回类型
delete_queue
删除队列。
delete_queue(queue_name: str, **kwargs: Any) -> None
参数
返回类型
delete_rule
删除主题订阅规则。
delete_rule(topic_name: str, subscription_name: str, rule_name: str, **kwargs: Any) -> None
参数
返回类型
delete_subscription
删除主题订阅。
delete_subscription(topic_name: str, subscription_name: str, **kwargs: Any) -> None
参数
返回类型
delete_topic
from_connection_string
从连接字符串创建客户端。
from_connection_string(conn_str: str, *, api_version: str | ApiVersion = ApiVersion.V2021_05, **kwargs: Any) -> ServiceBusAdministrationClient
参数
- api_version
- str 或 ApiVersion
用于请求的服务总线 API 版本。 默认值是与当前 SDK 兼容的最新服务版本。 设置为较旧版本可能会导致功能兼容性降低。
返回类型
get_namespace_properties
获取命名空间属性
get_namespace_properties(**kwargs: Any) -> NamespaceProperties
返回
命名空间属性。
返回类型
get_queue
获取队列的属性。
get_queue(queue_name: str, **kwargs: Any) -> QueueProperties
参数
返回
队列的属性。
返回类型
get_queue_runtime_properties
获取队列的运行时信息。
get_queue_runtime_properties(queue_name: str, **kwargs: Any) -> QueueRuntimeProperties
参数
返回
队列的运行时信息。
返回类型
get_rule
获取主题订阅规则的属性。
get_rule(topic_name: str, subscription_name: str, rule_name: str, **kwargs: Any) -> RuleProperties
参数
返回
指定规则的属性。
返回类型
get_subscription
获取主题订阅的属性。
get_subscription(topic_name: str, subscription_name: str, **kwargs: Any) -> SubscriptionProperties
参数
返回
SubscriptionProperties 的实例
返回类型
get_subscription_runtime_properties
获取主题订阅运行时信息。
get_subscription_runtime_properties(topic_name: str, subscription_name: str, **kwargs: Any) -> SubscriptionRuntimeProperties
参数
返回
SubscriptionRuntimeProperties 的实例
返回类型
get_topic
获取主题的属性。
get_topic(topic_name: str, **kwargs: Any) -> TopicProperties
参数
返回
主题的属性。
返回类型
get_topic_runtime_properties
获取主题的运行时信息。
get_topic_runtime_properties(topic_name: str, **kwargs: Any) -> TopicRuntimeProperties
参数
返回
主题的运行时信息。
返回类型
list_queues
列出 ServiceBus 命名空间的队列。
list_queues(**kwargs: Any) -> ItemPaged[QueueProperties]
返回
QueueProperties 的可迭代 (自动分页) 响应。
返回类型
list_queues_runtime_properties
列出 ServiceBus 命名空间中队列的运行时信息。
list_queues_runtime_properties(**kwargs: Any) -> ItemPaged[QueueRuntimeProperties]
返回
QueueRuntimeProperties 的可迭代 (自动分页) 响应。
返回类型
list_rules
列出主题订阅的规则。
list_rules(topic_name: str, subscription_name: str, **kwargs: Any) -> ItemPaged[RuleProperties]
参数
返回
RuleProperties 的可迭代 (自动分页) 响应。
返回类型
list_subscriptions
列出 ServiceBus 主题的订阅。
list_subscriptions(topic_name: str, **kwargs: Any) -> ItemPaged[SubscriptionProperties]
参数
返回
SubscriptionProperties 的可迭代 (自动分页) 响应。
返回类型
list_subscriptions_runtime_properties
列出 ServiceBus 主题的订阅运行时信息。
list_subscriptions_runtime_properties(topic_name: str, **kwargs: Any) -> ItemPaged[SubscriptionRuntimeProperties]
参数
返回
SubscriptionRuntimeProperties 的可迭代 (自动分页) 响应。
返回类型
list_topics
列出 ServiceBus 命名空间的主题。
list_topics(**kwargs: Any) -> ItemPaged[TopicProperties]
返回
TopicProperties 的可迭代 (自动分页) 响应。
返回类型
list_topics_runtime_properties
列出 ServiceBus 命名空间的主题运行时信息。
list_topics_runtime_properties(**kwargs: Any) -> ItemPaged[TopicRuntimeProperties]
返回
TopicRuntimeProperties 的可迭代 (自动分页) 响应。
返回类型
update_queue
更新队列。
在调用此方法之前,应使用 get_queue、 create_queue 或 list_queues 来获取 QueueProperties 实例,然后更新属性。 只能更新部分属性。 请参阅 https://docs.microsoft.com/en-us/rest/api/servicebus/update-queue 。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 QueueProperties 实例中指定的任何属性。 有关属性的名称,请参阅 ~azure.servicebus.management.QueueProperties。
update_queue(queue: QueueProperties | Mapping[str, Any], **kwargs: Any) -> None
参数
返回类型
update_rule
更新规则。
在调用此方法之前,应使用 get_rule、 create_rule 或 list_rules 来获取 RuleProperties 实例,然后更新属性。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 RuleProperties 实例中指定的任何属性。 有关属性的名称,请参阅 ~azure.servicebus.management.RuleProperties。
update_rule(topic_name: str, subscription_name: str, rule: RuleProperties | Mapping[str, Any], **kwargs: Any) -> None
参数
返回类型
update_subscription
更新订阅。
在调用此方法之前,应使用 get_subscription、 update_subscription 或 list_subscription 来获取 SubscriptionProperties 实例,然后更新属性。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 SubscriptionProperties 实例中指定的任何内容。 有关属性的名称,请参阅 ~azure.servicebus.management.SubscriptionProperties。
update_subscription(topic_name: str, subscription: SubscriptionProperties | Mapping[str, Any], **kwargs: Any) -> None
参数
- subscription
- SubscriptionProperties
从 get_subscription 返回的订阅 ,update_subscription 或 list_subscription 并具有更新的属性。
返回类型
update_topic
更新主题。
在调用此方法之前,应使用 get_topic、 create_topic 或 list_topics 来获取 TopicProperties 实例,然后更新属性。 只能更新部分属性。 请参阅 https://docs.microsoft.com/en-us/rest/api/servicebus/update-topic 。 还可以传递关键字 (keyword) 参数,以property_name>=<property_value>的形式<更新属性,这将替代 TopicProperties 实例中指定的任何内容。 有关属性的名称,请参阅 ~azure.servicebus.management.TopicProperties。
update_topic(topic: TopicProperties | Mapping[str, Any], **kwargs: Any) -> None
参数
返回类型
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈