How to use the aiormq.spec.Queue function in aiormq

To help you get started, we’ve selected a few aiormq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mosquito / aio-pika / aio_pika / queue.py View on Github external
async def purge(
        self, no_wait=False, timeout=None
    ) -> aiormq.spec.Queue.PurgeOk:
        """ Purge all messages from the queue.

        :param no_wait: no wait response
        :param timeout: execution timeout
        :return: :class:`None`
        """

        log.info("Purging queue: %r", self)

        return await asyncio.wait_for(
            self.channel.queue_purge(
                self.name,
                nowait=no_wait,
            ), timeout=timeout
        )
github mosquito / aio-pika / aio_pika / queue.py View on Github external
async def bind(
        self, exchange: ExchangeType_, routing_key: str=None, *,
        arguments=None, timeout: int=None
    ) -> aiormq.spec.Queue.BindOk:

        """ A binding is a relationship between an exchange and a queue.
        This can be simply read as: the queue is interested in messages
        from this exchange.

        Bindings can take an extra routing_key parameter. To avoid
        the confusion with a basic_publish parameter we're going to
        call it a binding key.

        :param exchange: :class:`aio_pika.exchange.Exchange` instance
        :param routing_key: routing key
        :param arguments: additional arguments
        :param timeout: execution timeout
        :raises asyncio.TimeoutError:
            when the binding timeout period has elapsed.
        :return: :class:`None`
github mosquito / aio-pika / aio_pika / queue.py View on Github external
async def unbind(
        self, exchange: ExchangeType_, routing_key: str=None,
        arguments: dict=None, timeout: int=None
    ) -> aiormq.spec.Queue.UnbindOk:

        """ Remove binding from exchange for this :class:`Queue` instance

        :param exchange: :class:`aio_pika.exchange.Exchange` instance
        :param routing_key: routing key
        :param arguments: additional arguments
        :param timeout: execution timeout
        :raises asyncio.TimeoutError:
            when the unbinding timeout period has elapsed.
        :return: :class:`None`
        """

        if routing_key is None:
            routing_key = self.name

        log.debug(
github mosquito / aio-pika / aio_pika / queue.py View on Github external
async def delete(self, *, if_unused=True, if_empty=True,
                     timeout=None) -> aiormq.spec.Queue.DeclareOk:

        """ Delete the queue.

        :param if_unused: Perform delete only when unused
        :param if_empty: Perform delete only when empty
        :param timeout: execution timeout
        :return: :class:`None`
        """

        log.info("Deleting %r", self)

        return await asyncio.wait_for(
            self.channel.queue_delete(
                self.name, if_unused=if_unused, if_empty=if_empty
            ), timeout=timeout
        )