azure.servicebus.management package

class azure.servicebus.management.AccessRights(value)[source]

Access rights of an authorization

listen = 'Listen'
manage = 'Manage'
send = 'Send'
class azure.servicebus.management.ApiVersion(value)[source]

An enumeration.

V2017_04 = '2017-04'
V2021_05 = '2021-05'
class azure.servicebus.management.AuthorizationRule(**kwargs: Any)[source]

Authorization rule of an entity.

Parameters
  • type (str) – The authorization type.

  • claim_type (str) – The claim type.

  • claim_value (str) – The claim value.

  • rights (list[AccessRights]) – Access rights of the entity. Values are ‘Send’, ‘Listen’, or ‘Manage’.

  • created_at_utc (datetime) – The date and time when the authorization rule was created.

  • modified_at_utc (datetime) – The date and time when the authorization rule was modified.

  • key_name (str) – The authorization rule key name.

  • primary_key (str) – The primary key of the authorization rule.

  • secondary_key (str) – The primary key of the authorization rule.

class azure.servicebus.management.CorrelationRuleFilter(**kwargs: Any)[source]

Represents the correlation filter expression.

Parameters
  • correlation_id (str) – Identifier of the correlation.

  • message_id (str) – Identifier of the message.

  • to (str) – Address to send to.

  • reply_to (str) – Address of the queue to reply to.

  • label (str) – Application specific label.

  • session_id (str) – Session identifier.

  • reply_to_session_id (str) – Session identifier to reply to.

  • content_type (str) – Content type of the message.

  • properties (dict[str, Union[str, int, float, bool, datetime, timedelta]]) – dictionary object for custom filters

class azure.servicebus.management.EntityAvailabilityStatus(value)[source]

Availability status of the entity

available = 'Available'
limited = 'Limited'
renaming = 'Renaming'
restoring = 'Restoring'
unknown = 'Unknown'
class azure.servicebus.management.EntityStatus(value)[source]

Status of a Service Bus resource

active = 'Active'
creating = 'Creating'
deleting = 'Deleting'
disabled = 'Disabled'
receive_disabled = 'ReceiveDisabled'
renaming = 'Renaming'
restoring = 'Restoring'
send_disabled = 'SendDisabled'
unknown = 'Unknown'
class azure.servicebus.management.FalseRuleFilter[source]

A sql filter with a sql expression that is always True

class azure.servicebus.management.MessageCountDetails(*, active_message_count: Optional[int] = None, dead_letter_message_count: Optional[int] = None, scheduled_message_count: Optional[int] = None, transfer_dead_letter_message_count: Optional[int] = None, transfer_message_count: Optional[int] = None, **kwargs)[source]

Details about the message counts in entity.

Parameters
  • active_message_count (int) – Number of active messages in the queue, topic, or subscription.

  • dead_letter_message_count (int) – Number of messages that are dead lettered.

  • scheduled_message_count (int) – Number of scheduled messages.

  • transfer_dead_letter_message_count (int) – Number of messages transferred into dead letters.

  • transfer_message_count (int) – Number of messages transferred to another queue, topic, or subscription.

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Return a dict that can be JSONify using json.dump.

Advanced usage might optionaly use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

key_transformer (function) – A key transformer function.

Returns

A dict JSON compatible object

Return type

dict

classmethod deserialize(data, content_type=None)

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()
classmethod from_dict(data, key_extractors=None, content_type=None)

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()
serialize(keep_readonly=False, **kwargs)

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

validate()

Validate this model recursively and return a list of ValidationError.

Returns

A list of validation error

Return type

list

class azure.servicebus.management.MessagingSku(value)[source]

The SKU for the messaging entity.

basic = 'Basic'
premium = 'Premium'
standard = 'Standard'
class azure.servicebus.management.NamespaceProperties(name: str, **kwargs: Any)[source]

The metadata related to a Service Bus namespace.

Variables
  • alias – Alias for the geo-disaster recovery Service Bus namespace.

  • created_at_utc – The exact time the namespace was created.

  • messaging_sku – The SKU for the messaging entity. Possible values include: “Basic”, “Standard”, “Premium”.

  • messaging_units – The number of messaging units allocated to the namespace.

  • modified_at_utc – The exact time the namespace was last modified.

  • name – Name of the namespace.

get(key: Any, default: Optional[Any] = None)Any
has_key(k: Any)bool
items()list
keys()list
update(*args: Any, **kwargs: Any)None
values()list
class azure.servicebus.management.NamespaceType(value)[source]

The type of entities the namespace can contain.

event_hub = 'EventHub'
messaging = 'Messaging'
mixed = 'Mixed'
notification_hub = 'NotificationHub'
relay = 'Relay'
class azure.servicebus.management.QueueProperties(name: str, **kwargs: Any)[source]

Properties of a Service Bus queue resource.

Variables
  • name – Name of the queue.

  • 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.

  • 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.

  • duplicate_detection_history_time_window – ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes.

  • availability_status – Availibility status of the entity. Possible values include: “Available”, “Limited”, “Renaming”, “Restoring”, “Unknown”.

  • 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.

  • 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.

  • status – Status of a Service Bus resource. Possible values include: “Active”, “Creating”, “Deleting”, “Disabled”, “ReceiveDisabled”, “Renaming”, “Restoring”, “SendDisabled”, “Unknown”.

  • 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.

get(key: Any, default: Optional[Any] = None)Any
has_key(k: Any)bool
items()list
keys()list
update(*args: Any, **kwargs: Any)None
values()list
class azure.servicebus.management.QueueRuntimeProperties[source]

Service Bus queue runtime properties.

property accessed_at_utc

Last time a message was sent, or the last time there was a receive request to this queue.

Return type

datetime

property active_message_count

Number of active messages in the queue, topic, or subscription.

Return type

int

property created_at_utc

The exact time the queue was created.

Return type

datetime

property dead_letter_message_count

Number of messages that are dead lettered.

Return type

int

property name

Name of the queue.

Return type

str

property scheduled_message_count

Number of scheduled messages.

Return type

int

property size_in_bytes

The size of the queue, in bytes.

Return type

int

property total_message_count

Total number of messages.

Return type

int

property transfer_dead_letter_message_count

Number of messages transferred into dead letters.

Return type

int

property transfer_message_count

Number of messages transferred to another queue, topic, or subscription.

Return type

int

property updated_at_utc

The exact the entity was updated.

Return type

datetime

class azure.servicebus.management.RuleProperties(name: str, **kwargs: Any)[source]

Properties of a topic subscription rule.

Parameters

name (str) – Name of the rule.

Variables
  • filter – The filter of the rule.

  • action – The action of the rule.

  • created_at_utc – The exact time the rule was created.

get(key: Any, default: Optional[Any] = None)Any
has_key(k: Any)bool
items()list
keys()list
update(*args: Any, **kwargs: Any)None
values()list
class azure.servicebus.management.ServiceBusAdministrationClient(fully_qualified_namespace: str, credential: TokenCredential, **kwargs: Dict[str, Any])[source]

Use this client to create, update, list, and delete resources of a ServiceBus namespace.

Parameters
  • fully_qualified_namespace (str) – The fully qualified host name for the Service Bus namespace.

  • credential (TokenCredential) – To authenticate to manage the entities of the ServiceBus namespace.

Keyword Arguments

api_version (str) – 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.

close()None[source]
create_queue(queue_name: str, **kwargs: Any)azure.servicebus.management._models.QueueProperties[source]

Create a queue.

Parameters

queue_name (str) – Name of the queue.

Keyword Arguments
  • authorization_rules (list[AuthorizationRule]) – Authorization rules for resource.

  • auto_delete_on_idle (Union[timedelta, str]) – 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 (bool) – A value that indicates whether this queue has dead letter support when a message expires.

  • default_message_time_to_live (Union[timedelta, str]) – 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 (Union[timedelta, str]) – 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 (bool) – Value that indicates whether server-side batched operations are enabled.

  • enable_express (bool) – 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 (bool) – A value that indicates whether the queue is to be partitioned across multiple message brokers.

  • lock_duration (Union[timedelta, str]) – 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 (int) – The maximum delivery count. A message is automatically deadlettered after this number of deliveries. Default value is 10.

  • max_size_in_megabytes (int) – The maximum size of the queue in megabytes, which is the size of memory allocated for the queue.

  • requires_duplicate_detection (bool) – A value indicating if this queue requires duplicate detection.

  • requires_session (bool) – A value that indicates whether the queue supports the concept of sessions.

  • forward_to (str) – The name of the recipient entity to which all the messages sent to the queue are forwarded to.

  • user_metadata (str) – Custom metdata that user can associate with the description. Max length is 1024 chars.

  • forward_dead_lettered_messages_to (str) – The name of the recipient entity to which all the dead-lettered messages of this subscription are forwarded to.

  • max_message_size_in_kilobytes (int) – 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.

Return type

QueueProperties

create_rule(topic_name: str, subscription_name: str, rule_name: str, **kwargs: Any)azure.servicebus.management._models.RuleProperties[source]

Create a rule for a topic subscription.

Parameters
  • topic_name (str) – The topic that will own the to-be-created subscription rule.

  • subscription_name (str) – The subscription that will own the to-be-created rule.

  • rule_name (str) – Name of the rule.

Keyword Arguments
Return type

RuleProperties

create_subscription(topic_name: str, subscription_name: str, **kwargs: Any)azure.servicebus.management._models.SubscriptionProperties[source]

Create a topic subscription.

Parameters
  • topic_name (str) – The topic that will own the to-be-created subscription.

  • subscription_name (str) – Name of the subscription.

Keyword Arguments
  • lock_duration (Union[timedelta, str]) – 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 (bool) – A value that indicates whether the queue supports the concept of sessions.

  • default_message_time_to_live (Union[timedelta, str]) – 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 (bool) – A value that indicates whether this subscription has dead letter support when a message expires.

  • dead_lettering_on_filter_evaluation_exceptions (bool) – A value that indicates whether this subscription has dead letter support when a message expires.

  • max_delivery_count (int) – The maximum delivery count. A message is automatically deadlettered after this number of deliveries. Default value is 10.

  • enable_batched_operations (bool) – Value that indicates whether server-side batched operations are enabled.

  • forward_to (str) – The name of the recipient entity to which all the messages sent to the subscription are forwarded to.

  • user_metadata (str) – Metadata associated with the subscription. Maximum number of characters is 1024.

  • forward_dead_lettered_messages_to (str) – The name of the recipient entity to which all the messages sent to the subscription are forwarded to.

  • auto_delete_on_idle (Union[timedelta, str]) – 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.

Return type

SubscriptionProperties

create_topic(topic_name: str, **kwargs: Any)azure.servicebus.management._models.TopicProperties[source]

Create a topic.

Parameters

topic_name (str) – Name of the topic.

Keyword Arguments
  • default_message_time_to_live (Union[timedelta, str]) – 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 (long) – The maximum size of the topic in megabytes, which is the size of memory allocated for the topic.

  • requires_duplicate_detection (bool) – A value indicating if this topic requires duplicate detection.

  • duplicate_detection_history_time_window (Union[timedelta, str]) – 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 (bool) – Value that indicates whether server-side batched operations are enabled.

  • size_in_bytes (int) – The size of the topic, in bytes.

  • filtering_messages_before_publishing (bool) – Filter messages before publishing.

  • authorization_rules (list[AuthorizationRule]) – Authorization rules for resource.

  • support_ordering (bool) – A value that indicates whether the topic supports ordering.

  • auto_delete_on_idle (Union[timedelta, str]) – 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 (bool) – A value that indicates whether the topic is to be partitioned across multiple message brokers.

  • enable_express (bool) – 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 (str) – Metadata associated with the topic.

  • max_message_size_in_kilobytes (int) – 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.

Return type

TopicProperties

delete_queue(queue_name: str, **kwargs: Any)None[source]

Delete a queue.

Parameters

queue_name (str) – The name of the queue or a QueueProperties with name.

Return type

None

delete_rule(topic_name: str, subscription_name: str, rule_name: str, **kwargs: Any)None[source]

Delete a topic subscription rule.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription_name (str) – The subscription that owns the topic.

  • rule_name (str) – The to-be-deleted rule.

Return type

None

delete_subscription(topic_name: str, subscription_name: str, **kwargs: Any)None[source]

Delete a topic subscription.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription_name (str) – The subscription to be deleted.

Return type

None

delete_topic(topic_name: str, **kwargs: Any)None[source]

Delete a topic.

Parameters

topic_name (str) – The topic to be deleted.

Return type

None

classmethod from_connection_string(conn_str: str, **kwargs: Any)azure.servicebus.management._management_client.ServiceBusAdministrationClient[source]

Create a client from connection string.

Parameters

conn_str (str) – The connection string of the Service Bus Namespace.

Keyword Arguments

api_version (str) – 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.

Return type

ServiceBusAdministrationClient

get_namespace_properties(**kwargs: Any)azure.servicebus.management._models.NamespaceProperties[source]

Get the namespace properties

Return type

NamespaceProperties

get_queue(queue_name: str, **kwargs: Any)azure.servicebus.management._models.QueueProperties[source]

Get the properties of a queue.

Parameters

queue_name (str) – The name of the queue.

Return type

QueueProperties

get_queue_runtime_properties(queue_name: str, **kwargs: Any)azure.servicebus.management._models.QueueRuntimeProperties[source]

Get the runtime information of a queue.

Parameters

queue_name (str) – The name of the queue.

Return type

QueueRuntimeProperties

get_rule(topic_name: str, subscription_name: str, rule_name: str, **kwargs: Any)azure.servicebus.management._models.RuleProperties[source]

Get the properties of a topic subscription rule.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription_name (str) – The subscription that owns the rule.

  • rule_name (str) – Name of the rule.

Return type

RuleProperties

get_subscription(topic_name: str, subscription_name: str, **kwargs: Any)azure.servicebus.management._models.SubscriptionProperties[source]

Get the properties of a topic subscription.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription_name (str) – name of the subscription.

Return type

SubscriptionProperties

get_subscription_runtime_properties(topic_name: str, subscription_name: str, **kwargs: Any)azure.servicebus.management._models.SubscriptionRuntimeProperties[source]

Get a topic subscription runtime info.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription_name (str) – name of the subscription.

Return type

SubscriptionRuntimeProperties

get_topic(topic_name: str, **kwargs: Any)azure.servicebus.management._models.TopicProperties[source]

Get the properties of a topic.

Parameters

topic_name (str) – The name of the topic.

Return type

TopicProperties

get_topic_runtime_properties(topic_name: str, **kwargs: Any)azure.servicebus.management._models.TopicRuntimeProperties[source]

Get a the runtime information of a topic.

Parameters

topic_name (str) – The name of the topic.

Return type

TopicRuntimeProperties

list_queues(**kwargs: Any)azure.core.paging.ItemPaged[azure.servicebus.management._models.QueueProperties][source]

List the queues of a ServiceBus namespace.

Returns

An iterable (auto-paging) response of QueueProperties.

Return type

ItemPaged[QueueProperties]

list_queues_runtime_properties(**kwargs: Any)azure.core.paging.ItemPaged[azure.servicebus.management._models.QueueRuntimeProperties][source]

List the runtime information of the queues in a ServiceBus namespace.

Returns

An iterable (auto-paging) response of QueueRuntimeProperties.

Return type

ItemPaged[QueueRuntimeProperties]

list_rules(topic_name: str, subscription_name: str, **kwargs: Any)azure.core.paging.ItemPaged[azure.servicebus.management._models.RuleProperties][source]

List the rules of a topic subscription.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription_name (str) – The subscription that owns the rules.

Returns

An iterable (auto-paging) response of RuleProperties.

Return type

ItemPaged[RuleProperties]

list_subscriptions(topic_name: str, **kwargs: Any)azure.core.paging.ItemPaged[azure.servicebus.management._models.SubscriptionProperties][source]

List the subscriptions of a ServiceBus Topic.

Parameters

topic_name (str) – The topic that owns the subscription.

Returns

An iterable (auto-paging) response of SubscriptionProperties.

Return type

ItemPaged[SubscriptionProperties]

list_subscriptions_runtime_properties(topic_name: str, **kwargs: Any)azure.core.paging.ItemPaged[azure.servicebus.management._models.SubscriptionRuntimeProperties][source]

List the subscriptions runtime information of a ServiceBus Topic.

Parameters

topic_name (str) – The topic that owns the subscription.

Returns

An iterable (auto-paging) response of SubscriptionRuntimeProperties.

Return type

ItemPaged[SubscriptionRuntimeProperties]

list_topics(**kwargs: Any)azure.core.paging.ItemPaged[azure.servicebus.management._models.TopicProperties][source]

List the topics of a ServiceBus namespace.

Returns

An iterable (auto-paging) response of TopicProperties.

Return type

ItemPaged[TopicProperties]

list_topics_runtime_properties(**kwargs: Any)azure.core.paging.ItemPaged[azure.servicebus.management._models.TopicRuntimeProperties][source]

List the topics runtime information of a ServiceBus namespace.

Returns

An iterable (auto-paging) response of TopicRuntimeProperties.

Return type

ItemPaged[TopicRuntimeProperties]

update_queue(queue: Union[azure.servicebus.management._models.QueueProperties, Mapping], **kwargs: Any)None[source]

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.

Parameters

queue (QueueProperties) – The queue that is returned from get_queue, create_queue or list_queues and has the updated properties.

Return type

None

update_rule(topic_name: str, subscription_name: str, rule: Union[azure.servicebus.management._models.RuleProperties, Mapping[str, Any]], **kwargs: Any)None[source]

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.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription_name (str) – The subscription that owns this rule.

  • rule (RuleProperties) – The rule that is returned from get_rule, create_rule, or list_rules and has the updated properties.

Return type

None

update_subscription(topic_name: str, subscription: Union[azure.servicebus.management._models.SubscriptionProperties, Mapping[str, Any]], **kwargs: Any)None[source]

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.

Parameters
  • topic_name (str) – The topic that owns the subscription.

  • subscription (SubscriptionProperties) – The subscription that is returned from get_subscription, update_subscription or list_subscription and has the updated properties.

Return type

None

update_topic(topic: Union[azure.servicebus.management._models.TopicProperties, Mapping[str, Any]], **kwargs: Any)None[source]

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.

Parameters

topic (TopicProperties) – The topic that is returned from get_topic, create_topic, or list_topics and has the updated properties.

Return type

None

class azure.servicebus.management.SqlRuleAction(sql_expression: Optional[str] = None, parameters: Optional[Dict[str, Union[str, int, float, datetime.datetime, datetime.timedelta]]] = None)[source]

Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage .

Parameters
  • sql_expression (str) – SQL expression. e.g. MyProperty=’ABC’

  • parameters (dict[str, Union[str, int, float, bool, datetime, timedelta]]) – Sets the value of the sql expression parameters if any.

class azure.servicebus.management.SqlRuleFilter(sql_expression: Optional[str] = None, parameters: Optional[Dict[str, Union[str, int, float, datetime.datetime, datetime.timedelta]]] = None)[source]

Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline.

Example:

Create SqlRuleFilter.
sql_filter = SqlRuleFilter("property1 = 'value'")
sql_filter_parametrized = SqlRuleFilter(
    "property1 = @param1 AND property2 = @param2",
    parameters={
        "@param1": "value",
        "@param2" : 1
    }
)
Parameters
  • sql_expression (str) – The SQL expression. e.g. MyProperty=’ABC’

  • parameters (dict[str, Union[str, int, float, bool, datetime, timedelta]]) – Sets the value of the sql expression parameters if any.

class azure.servicebus.management.SubscriptionProperties(name: str, **kwargs: Any)[source]

Properties of a Service Bus topic subscription resource.

Variables
  • name – Name of the subscription.

  • 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.

  • 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.

  • 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.

  • status – Status of a Service Bus resource. Possible values include: “Active”, “Creating”, “Deleting”, “Disabled”, “ReceiveDisabled”, “Renaming”, “Restoring”, “SendDisabled”, “Unknown”.

  • 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.

  • availability_status – Availability status of the entity. Possible values include: “Available”, “Limited”, “Renaming”, “Restoring”, “Unknown”.

get(key: Any, default: Optional[Any] = None)Any
has_key(k: Any)bool
items()list
keys()list
update(*args: Any, **kwargs: Any)None
values()list
class azure.servicebus.management.SubscriptionRuntimeProperties[source]

Runtime properties of a Service Bus topic subscription resource.

property accessed_at_utc

Last time a message was sent, or the last time there was a receive request

Return type

datetime

property active_message_count

Number of active messages in the subscription.

Return type

int

property created_at_utc

The exact time the subscription was created.

Return type

datetime

property dead_letter_message_count

Number of messages that are dead lettered.

Return type

int

property name

Name of subscription

Return type

str

property total_message_count

The number of messages in the subscription.

Return type

int

property transfer_dead_letter_message_count

Number of messages transferred into dead letters.

Return type

int

property transfer_message_count

Number of messages transferred to another queue, topic, or subscription.

Return type

int

property updated_at_utc

The exact time the entity is updated.

Return type

datetime

class azure.servicebus.management.TopicProperties(name: str, **kwargs: Any)[source]

Properties of a Service Bus topic resource.

Variables
  • name – Name of the topic.

  • 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.

  • 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.

  • 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.

  • status – Status of a Service Bus resource. Possible values include: “Active”, “Creating”, “Deleting”, “Disabled”, “ReceiveDisabled”, “Renaming”, “Restoring”, “SendDisabled”, “Unknown”.

  • 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.

  • enable_partitioning – A value that indicates whether the topic is to be partitioned across multiple message brokers.

  • availability_status – Availability status of the entity. Possible values include: “Available”, “Limited”, “Renaming”, “Restoring”, “Unknown”.

  • 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 topic. This feature is only available when using a Premium namespace and Service Bus API version “2021-05” or higher.

get(key: Any, default: Optional[Any] = None)Any
has_key(k: Any)bool
items()list
keys()list
update(*args: Any, **kwargs: Any)None
values()list
class azure.servicebus.management.TopicRuntimeProperties[source]

Runtime properties of a Service Bus topic resource.

property accessed_at_utc

Last time a message was sent, or the last time there was a receive request

Return type

datetime

property created_at_utc

The exact time the queue was created.

Return type

datetime

property name

The name of the topic.

Return type

str

property scheduled_message_count

Number of scheduled messages.

Return type

int

property size_in_bytes

The current size of the entity in bytes.

Return type

int

property subscription_count

The number of subscriptions in the topic.

Return type

int

property updated_at_utc

The exact time the entity was updated.

Return type

datetime

class azure.servicebus.management.TrueRuleFilter[source]

A sql filter with a sql expression that is always True