azure-servicebus/azure/servicebus/aio/async_receive_handler.py
async def close(self, exception=None):
        """Close down the receiver connection.

        If the receiver has already closed, this operation will do nothing. An optional
        exception can be passed in to indicate that the handler was shutdown due to error.
        It is recommended to open a handler within a context manager as
        opposed to calling the method directly.
        The receiver will be implicitly closed on completion of the message iterator,
        however this method will need to be called explicitly if the message iterator is not run
        to completion.

        .. note:: This operation is not thread-safe.

        :param exception: An optional exception if the handler is closing
         due to an error.
        :type exception: Exception

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START open_close_receiver_directly]
                :end-before: [END open_close_receiver_directly]
                :language: python
                :dedent: 4
                :caption: Iterate then explicitly close a Receiver.

        """
        if not self.running:
            return
        self.running = False
        self.receiver_shutdown = True
        self._used.set()
        await super(Receiver, self).close(exception=exception)
async def close(self, exception=None):
        if not self.running:
            return
        self.running = False
        self.receiver_shutdown = True
        self._used.set()
        await super(Receiver, self).close(exception=exception)
async def close ( self , exception = None ) : if not self . running : return self . running = False self . receiver_shutdown = True self . _used . set ( ) await super ( Receiver , self ) . close ( exception = exception )
Close down the receiver connection.

        If the receiver has already closed, this operation will do nothing. An optional
        exception can be passed in to indicate that the handler was shutdown due to error.
        It is recommended to open a handler within a context manager as
        opposed to calling the method directly.
        The receiver will be implicitly closed on completion of the message iterator,
        however this method will need to be called explicitly if the message iterator is not run
        to completion.

        .. note:: This operation is not thread-safe.

        :param exception: An optional exception if the handler is closing
         due to an error.
        :type exception: Exception

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START open_close_receiver_directly]
                :end-before: [END open_close_receiver_directly]
                :language: python
                :dedent: 4
                :caption: Iterate then explicitly close a Receiver.
Close down the receiver connection .