Beispiel #1
0
    def read_delete_subscription_message(self, 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.
        '''
        _validate_not_none('topic_name', topic_name)
        _validate_not_none('subscription_name', subscription_name)
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host = self._get_host()
        request.path = '/' + _str(topic_name) + \
                       '/subscriptions/' + _str(subscription_name) + \
                       '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = self._update_service_bus_header(request)
        response = self._perform_request(request)

        return _create_message(response, self)
Beispiel #2
0
    def peek_lock_queue_message(self, 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.
        '''
        _validate_not_none('queue_name', queue_name)
        request = HTTPRequest()
        request.method = 'POST'
        request.host = self._get_host()
        request.path = '/' + _str(queue_name) + '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = self._update_service_bus_header(request)
        response = self._perform_request(request)

        return _create_message(response, self)
    def read_delete_subscription_message(self,
                                         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.
        '''
        _validate_not_none('topic_name', topic_name)
        _validate_not_none('subscription_name', subscription_name)
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host = self._get_host()
        request.path = '/' + _str(topic_name) + \
                       '/subscriptions/' + _str(subscription_name) + \
                       '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = self._update_service_bus_header(request)
        response = self._perform_request(request)

        return _create_message(response, self)
    def peek_lock_queue_message(self, 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.
        '''
        _validate_not_none('queue_name', queue_name)
        request = HTTPRequest()
        request.method = 'POST'
        request.host = self._get_host()
        request.path = '/' + _str(queue_name) + '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = self._update_service_bus_header(request)
        response = self._perform_request(request)

        return _create_message(response, self)
    def peek_lock_subscription_message(self, 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: the name of the topic
        subscription_name: the name of the subscription
        '''
        _validate_not_none('topic_name', topic_name)
        _validate_not_none('subscription_name', subscription_name)
        request = HTTPRequest()
        request.method = 'POST'
        request.host = self._get_host()
        request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
        response = self._perform_request(request)

        return _create_message(response, self)
    def peek_lock_subscription_message(self, 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: the name of the topic
        subscription_name: the name of the subscription
        '''
        _validate_not_none('topic_name', topic_name)
        _validate_not_none('subscription_name', subscription_name)
        request = HTTPRequest()
        request.method = 'POST'
        request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
        request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
        response = self._perform_request(request)

        return _create_message(response, self)
    def read_delete_queue_message(self, 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
        '''
        _validate_not_none('queue_name', queue_name)
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host = self._get_host()
        request.path = '/' + str(queue_name) + '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
        response = self._perform_request(request)

        return _create_message(response, self)
    def read_delete_queue_message(self, 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
        '''
        _validate_not_none('queue_name', queue_name)
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
        request.path = '/' + str(queue_name) + '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
        response = self._perform_request(request)

        return _create_message(response, self)
    def read_delete_subscription_message(self, 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: the name of the topic
        subscription_name: the name of the subscription
        '''
        _validate_not_none('topic_name', topic_name)
        _validate_not_none('subscription_name', subscription_name)
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
        request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/head'
        request.query = [('timeout', _int_or_none(timeout))]
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
        response = self._perform_request(request)

        return _create_message(response, self)