# azure.servicebus.servicebusservice module

class `azure.servicebus.servicebusservice.``ServiceBusSASAuthentication`(key_name, key_value)
  `sign_request`(request, httpclient)

class `azure.servicebus.servicebusservice.``ServiceBusService`(service_namespace=None, account_key=None, issuer=None, x_ms_version='2011-06-01', host_base='.servicebus.windows.net', shared_access_key_name=None, shared_access_key_value=None, authentication=None, timeout=65, request_session=None)

  Bases: `object`

  Initializes the service bus service for a namespace with the specified authentication settings (SAS or ACS).

  service_namespace:
    Service bus namespace, required for all operations. If None, the value is set to the AZURE_SERVICEBUS_NAMESPACE env variable.
  account_key:
    ACS authentication account key. If None, the value is set to the AZURE_SERVICEBUS_ACCESS_KEY env variable. Note that if both SAS and ACS settings are specified, SAS is used.
  issuer:
    ACS authentication issuer. If None, the value is set to the AZURE_SERVICEBUS_ISSUER env variable. Note that if both SAS and ACS settings are specified, SAS is used.
  x_ms_version:
    Unused. Kept for backwards compatibility.
  host_base:
    Optional. Live host base url. Defaults to Azure url. Override this for on-premise.
  shared_access_key_name:
    SAS authentication key name. Note that if both SAS and ACS settings are specified, SAS is used.
  shared_access_key_value:
    SAS authentication key value. Note that if both SAS and ACS settings are specified, SAS is used.
  authentication:
    Instance of authentication class. If this is specified, then ACS and SAS parameters are ignored.
  timeout:
    Optional. Timeout for the http request, in seconds.
  request_session:
    Optional. Session object to use for http requests.
  `account_key`
  `create_event_hub`(hub_name, hub=None, fail_on_exist=False)

    Creates a new Event Hub.

    hub_name:
      Name of event hub.
    hub:
      Optional. Event hub properties. Instance of EventHub class.
    hub.message_retention_in_days:
      Number of days to retain the events for this Event Hub.

    hub.status: Status of the Event Hub (enabled or disabled). hub.user_metadata: User metadata. hub.partition_count: Number of shards on the Event Hub. fail_on_exist:

    > Specify whether to throw an exception when the event hub exists.

  `create_queue`(queue_name, queue=None, fail_on_exist=False)

    Creates a new queue. Once created, this queue’s resource manifest is immutable.

    queue_name:
      Name of the queue to create.
    queue:
      Queue object to create.
    fail_on_exist:
      Specify whether to throw an exception when the queue exists.
  `create_rule`(topic_name, subscription_name, rule_name, rule=None, fail_on_exist=False)

    Creates a new rule. Once created, this rule’s resource manifest is immutable.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    rule_name:
      Name of the rule.
    fail_on_exist:
      Specify whether to throw an exception when the rule exists.
  `create_subscription`(topic_name, subscription_name, subscription=None, fail_on_exist=False)

    Creates a new subscription. Once created, this subscription resource manifest is immutable.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    fail_on_exist:
      Specify whether throw exception when subscription exists.
  `create_topic`(topic_name, topic=None, fail_on_exist=False)

    Creates a new topic. Once created, this topic resource manifest is immutable.

    topic_name:
      Name of the topic to create.
    topic:
      Topic object to create.
    fail_on_exist:
      Specify whether to throw an exception when the topic exists.
  `delete_event_hub`(hub_name, fail_not_exist=False)

    Deletes an Event Hub. This operation will also remove all associated state.

    hub_name:
      Name of the event hub to delete.
    fail_not_exist:
      Specify whether to throw an exception if the event hub doesn’t exist.
  `delete_queue`(queue_name, fail_not_exist=False)

    Deletes an existing queue. This operation will also remove all associated state including messages in the queue.

    queue_name:
      Name of the queue to delete.
    fail_not_exist:
      Specify whether to throw an exception if the queue doesn’t exist.
  `delete_queue_message`(queue_name, sequence_number, lock_token)

    Completes processing on a locked message and delete it from the queue. This operation should only be called after processing a previously locked message is successful to maintain At-Least-Once delivery assurances.

    queue_name:
      Name of the queue.
    sequence_number:
      The sequence number of the message to be deleted as returned in BrokerProperties[‘SequenceNumber’] by the Peek Message operation.
    lock_token:
      The ID of the lock as returned by the Peek Message operation in BrokerProperties[‘LockToken’]
  `delete_rule`(topic_name, subscription_name, rule_name, fail_not_exist=False)

    Deletes an existing rule.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    rule_name:
      Name of the rule to delete. DEFAULT_RULE_NAME=$Default. Use DEFAULT_RULE_NAME to delete default rule for the subscription.
    fail_not_exist:
      Specify whether throw exception when rule doesn’t exist.
  `delete_subscription`(topic_name, subscription_name, fail_not_exist=False)

    Deletes an existing subscription.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription to delete.
    fail_not_exist:
      Specify whether to throw an exception when the subscription doesn’t exist.
  `delete_subscription_message`(topic_name, subscription_name, sequence_number, lock_token)

    Completes processing on a locked message and delete it from the subscription. This operation should only be called after processing a previously locked message is successful to maintain At-Least-Once delivery assurances.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    sequence_number:
      The sequence number of the message to be deleted as returned in BrokerProperties[‘SequenceNumber’] by the Peek Message operation.
    lock_token:
      The ID of the lock as returned by the Peek Message operation in BrokerProperties[‘LockToken’]
  `delete_topic`(topic_name, fail_not_exist=False)

    Deletes an existing topic. This operation will also remove all associated state including associated subscriptions.

    topic_name:
      Name of the topic to delete.
    fail_not_exist:
      Specify whether throw exception when topic doesn’t exist.
  static `format_dead_letter_queue_name`(queue_name)

    Get the dead letter name of this queue

  static `format_dead_letter_subscription_name`(subscription_name)

    Get the dead letter name of this subscription

  `get_event_hub`(hub_name)

    Retrieves an existing event hub.

    hub_name:
      Name of the event hub.
  `get_queue`(queue_name)

    Retrieves an existing queue.

    queue_name:
      Name of the queue.
  `get_rule`(topic_name, subscription_name, rule_name)

    Retrieves the description for the specified rule.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    rule_name:
      Name of the rule.
  `get_subscription`(topic_name, subscription_name)

    Gets an existing subscription.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
  `get_topic`(topic_name)

    Retrieves the description for the specified topic.

    topic_name:
      Name of the topic.
  `issuer`
  `list_queues`()

    Enumerates the queues in the service namespace.

  `list_rules`(topic_name, subscription_name)

    Retrieves the rules that exist under the specified subscription.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
  `list_subscriptions`(topic_name)

    Retrieves the subscriptions in the specified topic.

    topic_name:
      Name of the topic.
  `list_topics`()

    Retrieves the topics in the service namespace.

  `peek_lock_queue_message`(queue_name, timeout='60')

    Automically retrieves and locks a message from a queue for processing. The message is guaranteed not to be delivered to other receivers (on the same subscription only) during the lock duration period specified in the queue description. Once the lock expires, the message will be available to other receivers. In order to complete processing of the message, the receiver should issue a delete command with the lock ID received from this operation. To abandon processing of the message and unlock it for other receivers, an Unlock Message command should be issued, or the lock duration period can expire.

    queue_name:
      Name of the queue.
    timeout:
      Optional. The timeout parameter is expressed in seconds.
  `peek_lock_subscription_message`(topic_name, subscription_name, timeout='60')

    This operation is used to atomically retrieve and lock a message for processing. The message is guaranteed not to be delivered to other receivers during the lock duration period specified in buffer description. Once the lock expires, the message will be available to other receivers (on the same subscription only) during the lock duration period specified in the topic description. Once the lock expires, the message will be available to other receivers. In order to complete processing of the message, the receiver should issue a delete command with the lock ID received from this operation. To abandon processing of the message and unlock it for other receivers, an Unlock Message command should be issued, or the lock duration period can expire.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    timeout:
      Optional. The timeout parameter is expressed in seconds.
  `read_delete_queue_message`(queue_name, timeout='60')

    Reads and deletes a message from a queue as an atomic operation. This operation should be used when a best-effort guarantee is sufficient for an application; that is, using this operation it is possible for messages to be lost if processing fails.

    queue_name:
      Name of the queue.
    timeout:
      Optional. The timeout parameter is expressed in seconds.
  `read_delete_subscription_message`(topic_name, subscription_name, timeout='60')

    Read and delete a message from a subscription as an atomic operation. This operation should be used when a best-effort guarantee is sufficient for an application; that is, using this operation it is possible for messages to be lost if processing fails.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    timeout:
      Optional. The timeout parameter is expressed in seconds.
  `receive_queue_message`(queue_name, peek_lock=True, timeout=60)

    Receive a message from a queue for processing.

    queue_name:
      Name of the queue.
    peek_lock:
      Optional. True to retrieve and lock the message. False to read and delete the message. Default is True (lock).
    timeout:
      Optional. The timeout parameter is expressed in seconds.
  `receive_subscription_message`(topic_name, subscription_name, peek_lock=True, timeout=60)

    Receive a message from a subscription for processing.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    peek_lock:
      Optional. True to retrieve and lock the message. False to read and delete the message. Default is True (lock).
    timeout:
      Optional. The timeout parameter is expressed in seconds.
  `renew_lock_queue_message`(queue_name, sequence_number, lock_token)

    Renew lock on an already locked message on a given queue. A message must have first been locked by a receiver before this operation is called.

    queue_name:
      Name of the queue.
    sequence_number:
      The sequence number of the message to be unlocked as returned in BrokerProperties[‘SequenceNumber’] by the Peek Message operation.
    lock_token:
      The ID of the lock as returned by the Peek Message operation in BrokerProperties[‘LockToken’]
  `renew_lock_subscription_message`(topic_name, subscription_name, sequence_number, lock_token)

    Renew the lock on an already locked message on a given subscription. A message must have first been locked by a receiver before this operation is called.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    sequence_number:
      The sequence number of the message to be unlocked as returned in BrokerProperties[‘SequenceNumber’] by the Peek Message operation.
    lock_token:
      The ID of the lock as returned by the Peek Message operation in BrokerProperties[‘LockToken’]
  `send_event`(hub_name, message, device_id=None, broker_properties=None)

    Sends a new message event to an Event Hub.

  `send_queue_message`(queue_name, message=None)

    Sends a message into the specified queue. The limit to the number of messages which may be present in the topic is governed by the message size the MaxTopicSizeInMegaBytes. If this message will cause the queue to exceed its quota, a quota exceeded error is returned and the message will be rejected.

    queue_name:
      Name of the queue.
    message:
      Message object containing message body and properties.
  `send_topic_message`(topic_name, message=None)

    Enqueues a message into the specified topic. The limit to the number of messages which may be present in the topic is governed by the message size in MaxTopicSizeInBytes. If this message causes the topic to exceed its quota, a quota exceeded error is returned and the message will be rejected.

    topic_name:
      Name of the topic.
    message:
      Message object containing message body and properties.
  `set_proxy`(host, port, user=None, password=None)

    Sets the proxy server host and port for the HTTP CONNECT Tunnelling.

    host:
      Address of the proxy. Ex: ‘192.168.0.100’
    port:
      Port of the proxy. Ex: 6000
    user:
      User for proxy authorization.
    password:
      Password for proxy authorization.
  `timeout`
  `unlock_queue_message`(queue_name, sequence_number, lock_token)

    Unlocks a message for processing by other receivers on a given queue. This operation deletes the lock object, causing the message to be unlocked. A message must have first been locked by a receiver before this operation is called.

    queue_name:
      Name of the queue.
    sequence_number:
      The sequence number of the message to be unlocked as returned in BrokerProperties[‘SequenceNumber’] by the Peek Message operation.
    lock_token:
      The ID of the lock as returned by the Peek Message operation in BrokerProperties[‘LockToken’]
  `unlock_subscription_message`(topic_name, subscription_name, sequence_number, lock_token)

    Unlock a message for processing by other receivers on a given subscription. This operation deletes the lock object, causing the message to be unlocked. A message must have first been locked by a receiver before this operation is called.

    topic_name:
      Name of the topic.
    subscription_name:
      Name of the subscription.
    sequence_number:
      The sequence number of the message to be unlocked as returned in BrokerProperties[‘SequenceNumber’] by the Peek Message operation.
    lock_token:
      The ID of the lock as returned by the Peek Message operation in BrokerProperties[‘LockToken’]
  `update_event_hub`(hub_name, hub=None)

    Updates an Event Hub.

    hub_name:
      Name of event hub.
    hub:
      Optional. Event hub properties. Instance of EventHub class.
    hub.message_retention_in_days:
      Number of days to retain the events for this Event Hub.
  `with_filter`(filter)

    Returns a new service which will process requests with the specified filter. Filtering operations can include logging, automatic retrying, etc… The filter is a lambda which receives the HTTPRequest and another lambda. The filter can perform any pre-processing on the request, pass it off to the next lambda, and then perform any post-processing on the response.

class `azure.servicebus.servicebusservice.``ServiceBusWrapTokenAuthentication`(account_key, issuer)
  `sign_request`(request, httpclient)