ServiceBusAdministrationClient Class
Use this client to create, update, list, and delete resources of a ServiceBus namespace.
- Inheritance
-
builtins.objectServiceBusAdministrationClient
Constructor
ServiceBusAdministrationClient(fully_qualified_namespace: str, credential: TokenCredential, *, api_version: str | ApiVersion = ApiVersion.V2021_05, **kwargs: Any)
Parameters
Name | Description |
---|---|
fully_qualified_namespace
Required
|
The fully qualified host name for the Service Bus namespace. |
credential
Required
|
<xref:TokenCredential>
To authenticate to manage the entities of the ServiceBus namespace. |
Keyword-Only Parameters
Name | Description |
---|---|
api_version
|
str or
ApiVersion
The Service Bus API version to use for requests. Default value is the most recent service version that is compatible with the current SDK. Setting to an older version may result in reduced feature compatibility. Default value: ApiVersion.V2021_05
|
Methods
close | |
create_queue |
Create a queue. |
create_rule |
Create a rule for a topic subscription. |
create_subscription |
Create a topic subscription. |
create_topic |
Create a topic. |
delete_queue |
Delete a queue. |
delete_rule |
Delete a topic subscription rule. |
delete_subscription |
Delete a topic subscription. |
delete_topic |
Delete a topic. |
from_connection_string |
Create a client from connection string. |
get_namespace_properties |
Get the namespace properties |
get_queue |
Get the properties of a queue. |
get_queue_runtime_properties |
Get the runtime information of a queue. |
get_rule |
Get the properties of a topic subscription rule. |
get_subscription |
Get the properties of a topic subscription. |
get_subscription_runtime_properties |
Get a topic subscription runtime info. |
get_topic |
Get the properties of a topic. |
get_topic_runtime_properties |
Get a the runtime information of a topic. |
list_queues |
List the queues of a ServiceBus namespace. |
list_queues_runtime_properties |
List the runtime information of the queues in a ServiceBus namespace. |
list_rules |
List the rules of a topic subscription. |
list_subscriptions |
List the subscriptions of a ServiceBus Topic. |
list_subscriptions_runtime_properties |
List the subscriptions runtime information of a ServiceBus Topic. |
list_topics |
List the topics of a ServiceBus namespace. |
list_topics_runtime_properties |
List the topics runtime information of a ServiceBus namespace. |
update_queue |
Update a queue. Before calling this method, you should use get_queue, create_queue or list_queues to get a QueueProperties instance, then update the properties. Only a portion of properties can be updated. Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-queue. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the QueueProperties instance. Refer to ~azure.servicebus.management.QueueProperties for names of properties. |
update_rule |
Update a rule. Before calling this method, you should use get_rule, create_rule or list_rules to get a RuleProperties instance, then update the properties. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the RuleProperties instance. Refer to ~azure.servicebus.management.RuleProperties for names of properties. |
update_subscription |
Update a subscription. Before calling this method, you should use get_subscription, update_subscription or list_subscription to get a SubscriptionProperties instance, then update the properties. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the SubscriptionProperties instance. Refer to ~azure.servicebus.management.SubscriptionProperties for names of properties. |
update_topic |
Update a topic. Before calling this method, you should use get_topic, create_topic or list_topics to get a TopicProperties instance, then update the properties. Only a portion of properties can be updated. Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-topic. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the TopicProperties instance. Refer to ~azure.servicebus.management.TopicProperties for names of properties. |
close
close() -> None
create_queue
Create a 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
Parameters
Name | Description |
---|---|
queue_name
Required
|
Name of the queue. |
Keyword-Only Parameters
Name | Description |
---|---|
authorization_rules
|
Authorization rules for resource. |
auto_delete_on_idle
|
ISO 8601 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
dead_lettering_on_message_expiration
|
A value that indicates whether this queue has dead letter support when a message expires. |
default_message_time_to_live
|
ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
duplicate_detection_history_time_window
|
ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
enable_batched_operations
|
Value that indicates whether server-side batched operations are enabled. |
enable_express
|
A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. |
enable_partitioning
|
A value that indicates whether the queue is to be partitioned across multiple message brokers. |
lock_duration
|
ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
max_delivery_count
|
The maximum delivery count. A message is automatically deadlettered after this number of deliveries. Default value is 10. |
max_size_in_megabytes
|
The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. |
requires_duplicate_detection
|
A value indicating if this queue requires duplicate detection. |
requires_session
|
A value that indicates whether the queue supports the concept of sessions. |
forward_to
|
The name of the recipient entity to which all the messages sent to the queue are forwarded to. |
user_metadata
|
Custom metdata that user can associate with the description. Max length is 1024 chars. |
forward_dead_lettered_messages_to
|
The name of the recipient entity to which all the dead-lettered messages of this subscription are forwarded to. |
max_message_size_in_kilobytes
|
The maximum size in kilobytes of message payload that can be accepted by the queue. This feature is only available when using a Premium namespace and Service Bus API version "2021-05" or higher. The minimum allowed value is 1024 while the maximum allowed value is 102400. Default value is 1024. |
Returns
Type | Description |
---|---|
Returns properties of queue resource. |
create_rule
Create a rule for a topic subscription.
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
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that will own the to-be-created subscription rule. |
subscription_name
Required
|
The subscription that will own the to-be-created rule. |
rule_name
Required
|
Name of the rule. |
Keyword-Only Parameters
Name | Description |
---|---|
filter
|
The filter of the rule. The default value is ~azure.servicebus.management.TrueRuleFilter Default value: <azure.servicebus.management._models.TrueRuleFilter object at 0x000002519E2E4DD0>
|
action
|
The action of the rule. |
Returns
Type | Description |
---|---|
Rule properties for a topic subscription. |
create_subscription
Create a topic 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
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that will own the to-be-created subscription. |
subscription_name
Required
|
Name of the subscription. |
Keyword-Only Parameters
Name | Description |
---|---|
lock_duration
|
ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
requires_session
|
A value that indicates whether the queue supports the concept of sessions. |
default_message_time_to_live
|
ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
dead_lettering_on_message_expiration
|
A value that indicates whether this subscription has dead letter support when a message expires. |
dead_lettering_on_filter_evaluation_exceptions
|
A value that indicates whether this subscription has dead letter support when a message expires. |
max_delivery_count
|
The maximum delivery count. A message is automatically deadlettered after this number of deliveries. Default value is 10. |
enable_batched_operations
|
Value that indicates whether server-side batched operations are enabled. |
forward_to
|
The name of the recipient entity to which all the messages sent to the subscription are forwarded to. |
user_metadata
|
Metadata associated with the subscription. Maximum number of characters is 1024. |
forward_dead_lettered_messages_to
|
The name of the recipient entity to which all the messages sent to the subscription are forwarded to. |
auto_delete_on_idle
|
ISO 8601 timeSpan idle interval after which the subscription is automatically deleted. The minimum duration is 5 minutes. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
Returns
Type | Description |
---|---|
Return properties of a topic subscription resource. |
create_topic
Create a 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
Parameters
Name | Description |
---|---|
topic_name
Required
|
Name of the topic. |
Keyword-Only Parameters
Name | Description |
---|---|
default_message_time_to_live
|
ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
max_size_in_megabytes
|
The maximum size of the topic in megabytes, which is the size of memory allocated for the topic. |
requires_duplicate_detection
|
A value indicating if this topic requires duplicate detection. |
duplicate_detection_history_time_window
|
ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
enable_batched_operations
|
Value that indicates whether server-side batched operations are enabled. |
size_in_bytes
|
The size of the topic, in bytes. |
filtering_messages_before_publishing
|
Filter messages before publishing. |
authorization_rules
|
Authorization rules for resource. |
support_ordering
|
A value that indicates whether the topic supports ordering. |
auto_delete_on_idle
|
ISO 8601 timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. Input value of either type ~datetime.timedelta or string in ISO 8601 duration format like "PT300S" is accepted. |
enable_partitioning
|
A value that indicates whether the topic is to be partitioned across multiple message brokers. |
enable_express
|
A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. |
user_metadata
|
Metadata associated with the topic. |
max_message_size_in_kilobytes
|
The maximum size in kilobytes of message payload that can be accepted by the queue. This feature is only available when using a Premium namespace and Service Bus API version "2021-05" or higher. The minimum allowed value is 1024 while the maximum allowed value is 102400. Default value is 1024. |
Returns
Type | Description |
---|---|
Returns properties of a topic resource. |
delete_queue
Delete a queue.
delete_queue(queue_name: str, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
queue_name
Required
|
The name of the queue or a QueueProperties with name. |
Returns
Type | Description |
---|---|
delete_rule
Delete a topic subscription rule.
delete_rule(topic_name: str, subscription_name: str, rule_name: str, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription_name
Required
|
The subscription that owns the topic. |
rule_name
Required
|
The to-be-deleted rule. |
Returns
Type | Description |
---|---|
delete_subscription
Delete a topic subscription.
delete_subscription(topic_name: str, subscription_name: str, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription_name
Required
|
The subscription to be deleted. |
Returns
Type | Description |
---|---|
delete_topic
Delete a topic.
delete_topic(topic_name: str, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic to be deleted. |
Returns
Type | Description |
---|---|
from_connection_string
Create a client from connection string.
from_connection_string(conn_str: str, *, api_version: str | ApiVersion = ApiVersion.V2021_05, **kwargs: Any) -> ServiceBusAdministrationClient
Parameters
Name | Description |
---|---|
conn_str
Required
|
The connection string of the Service Bus Namespace. |
Keyword-Only Parameters
Name | Description |
---|---|
api_version
|
str or
ApiVersion
The Service Bus API version to use for requests. Default value is the most recent service version that is compatible with the current SDK. Setting to an older version may result in reduced feature compatibility. Default value: ApiVersion.V2021_05
|
Returns
Type | Description |
---|---|
Returns a ServiceBusAdministrationClient. |
get_namespace_properties
Get the namespace properties
get_namespace_properties(**kwargs: Any) -> NamespaceProperties
Returns
Type | Description |
---|---|
The namespace properties. |
get_queue
Get the properties of a queue.
get_queue(queue_name: str, **kwargs: Any) -> QueueProperties
Parameters
Name | Description |
---|---|
queue_name
Required
|
The name of the queue. |
Returns
Type | Description |
---|---|
The properties of the queue. |
get_queue_runtime_properties
Get the runtime information of a queue.
get_queue_runtime_properties(queue_name: str, **kwargs: Any) -> QueueRuntimeProperties
Parameters
Name | Description |
---|---|
queue_name
Required
|
The name of the queue. |
Returns
Type | Description |
---|---|
The runtime information of the queue. |
get_rule
Get the properties of a topic subscription rule.
get_rule(topic_name: str, subscription_name: str, rule_name: str, **kwargs: Any) -> RuleProperties
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription_name
Required
|
The subscription that owns the rule. |
rule_name
Required
|
Name of the rule. |
Returns
Type | Description |
---|---|
The properties of the specified rule. |
get_subscription
Get the properties of a topic subscription.
get_subscription(topic_name: str, subscription_name: str, **kwargs: Any) -> SubscriptionProperties
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription_name
Required
|
name of the subscription. |
Returns
Type | Description |
---|---|
An instance of SubscriptionProperties |
get_subscription_runtime_properties
Get a topic subscription runtime info.
get_subscription_runtime_properties(topic_name: str, subscription_name: str, **kwargs: Any) -> SubscriptionRuntimeProperties
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription_name
Required
|
name of the subscription. |
Returns
Type | Description |
---|---|
An instance of SubscriptionRuntimeProperties |
get_topic
Get the properties of a topic.
get_topic(topic_name: str, **kwargs: Any) -> TopicProperties
Parameters
Name | Description |
---|---|
topic_name
Required
|
The name of the topic. |
Returns
Type | Description |
---|---|
The properties of the topic. |
get_topic_runtime_properties
Get a the runtime information of a topic.
get_topic_runtime_properties(topic_name: str, **kwargs: Any) -> TopicRuntimeProperties
Parameters
Name | Description |
---|---|
topic_name
Required
|
The name of the topic. |
Returns
Type | Description |
---|---|
The runtime info of the topic. |
list_queues
List the queues of a ServiceBus namespace.
list_queues(**kwargs: Any) -> ItemPaged[QueueProperties]
Returns
Type | Description |
---|---|
An iterable (auto-paging) response of QueueProperties. |
list_queues_runtime_properties
List the runtime information of the queues in a ServiceBus namespace.
list_queues_runtime_properties(**kwargs: Any) -> ItemPaged[QueueRuntimeProperties]
Returns
Type | Description |
---|---|
An iterable (auto-paging) response of QueueRuntimeProperties. |
list_rules
List the rules of a topic subscription.
list_rules(topic_name: str, subscription_name: str, **kwargs: Any) -> ItemPaged[RuleProperties]
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription_name
Required
|
The subscription that owns the rules. |
Returns
Type | Description |
---|---|
An iterable (auto-paging) response of RuleProperties. |
list_subscriptions
List the subscriptions of a ServiceBus Topic.
list_subscriptions(topic_name: str, **kwargs: Any) -> ItemPaged[SubscriptionProperties]
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
Returns
Type | Description |
---|---|
An iterable (auto-paging) response of SubscriptionProperties. |
list_subscriptions_runtime_properties
List the subscriptions runtime information of a ServiceBus Topic.
list_subscriptions_runtime_properties(topic_name: str, **kwargs: Any) -> ItemPaged[SubscriptionRuntimeProperties]
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
Returns
Type | Description |
---|---|
An iterable (auto-paging) response of SubscriptionRuntimeProperties. |
list_topics
List the topics of a ServiceBus namespace.
list_topics(**kwargs: Any) -> ItemPaged[TopicProperties]
Returns
Type | Description |
---|---|
An iterable (auto-paging) response of TopicProperties. |
list_topics_runtime_properties
List the topics runtime information of a ServiceBus namespace.
list_topics_runtime_properties(**kwargs: Any) -> ItemPaged[TopicRuntimeProperties]
Returns
Type | Description |
---|---|
An iterable (auto-paging) response of TopicRuntimeProperties. |
update_queue
Update a queue.
Before calling this method, you should use get_queue, create_queue or list_queues to get a QueueProperties instance, then update the properties. Only a portion of properties can be updated. Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-queue. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the QueueProperties instance. Refer to ~azure.servicebus.management.QueueProperties for names of properties.
update_queue(queue: QueueProperties | Mapping[str, Any], **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
queue
Required
|
The queue that is returned from get_queue, create_queue or list_queues and has the updated properties. |
Returns
Type | Description |
---|---|
update_rule
Update a rule.
Before calling this method, you should use get_rule, create_rule or list_rules to get a RuleProperties instance, then update the properties. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the RuleProperties instance. Refer to ~azure.servicebus.management.RuleProperties for names of properties.
update_rule(topic_name: str, subscription_name: str, rule: RuleProperties | Mapping[str, Any], **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription_name
Required
|
The subscription that owns this rule. |
rule
Required
|
The rule that is returned from get_rule, create_rule, or list_rules and has the updated properties. |
Returns
Type | Description |
---|---|
update_subscription
Update a subscription.
Before calling this method, you should use get_subscription, update_subscription or list_subscription to get a SubscriptionProperties instance, then update the properties. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the SubscriptionProperties instance. Refer to ~azure.servicebus.management.SubscriptionProperties for names of properties.
update_subscription(topic_name: str, subscription: SubscriptionProperties | Mapping[str, Any], **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
topic_name
Required
|
The topic that owns the subscription. |
subscription
Required
|
The subscription that is returned from get_subscription, update_subscription or list_subscription and has the updated properties. |
Returns
Type | Description |
---|---|
update_topic
Update a topic.
Before calling this method, you should use get_topic, create_topic or list_topics to get a TopicProperties instance, then update the properties. Only a portion of properties can be updated. Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-topic. You could also pass keyword arguments for updating properties in the form of <property_name>=<property_value> which will override whatever was specified in the TopicProperties instance. Refer to ~azure.servicebus.management.TopicProperties for names of properties.
update_topic(topic: TopicProperties | Mapping[str, Any], **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
topic
Required
|
The topic that is returned from get_topic, create_topic, or list_topics and has the updated properties. |
Returns
Type | Description |
---|---|
Azure SDK for Python