示例#1
0
 def unbind(self):
     """Delete the binding on the server."""
     return _SYN(self.channel.queue_unbind,
                 queue=self.name,
                 exchange=self.exchange.name,
                 routing_key=self.routing_key,
                 arguments=self.binding_arguments)
示例#2
0
    def qos(self, prefetch_size=0, prefetch_count=0, apply_global=False):
        """Specify quality of service.

        The client can request that messages should be sent in
        advance so that when the client finishes processing a message,
        the following message is already held locally, rather than needing
        to be sent down the channel. Prefetching gives a performance
        improvement.

        The prefetch window is Ignored if the :attr:`no_ack` option is set.

        :param prefetch_size: Specify the prefetch window in octets.
          The server will send a message in advance if it is equal to
          or smaller in size than the available prefetch size (and
          also falls within other prefetch limits). May be set to zero,
          meaning "no specific limit", although other prefetch limits
          may still apply.

        :param prefetch_count: Specify the prefetch window in terms of
          whole messages.

        :param apply_global: Apply new settings globally on all channels.
          Currently not supported by RabbitMQ.

        """
        return _SYN(self.channel.basic_qos, prefetch_size, prefetch_count,
                    apply_global)
示例#3
0
    def qos(self, prefetch_size=0, prefetch_count=0, apply_global=False):
        """Specify quality of service.

        The client can request that messages should be sent in
        advance so that when the client finishes processing a message,
        the following message is already held locally, rather than needing
        to be sent down the channel. Prefetching gives a performance
        improvement.

        The prefetch window is Ignored if the :attr:`no_ack` option is set.

        :param prefetch_size: Specify the prefetch window in octets.
          The server will send a message in advance if it is equal to
          or smaller in size than the available prefetch size (and
          also falls within other prefetch limits). May be set to zero,
          meaning "no specific limit", although other prefetch limits
          may still apply.

        :param prefetch_count: Specify the prefetch window in terms of
          whole messages.

        :param apply_global: Apply new settings globally on all channels.
          Currently not supported by RabbitMQ.

        """
        return _SYN(self.channel.basic_qos, prefetch_size,
                                            prefetch_count,
                                            apply_global)
示例#4
0
    def queue_bind(self, nowait=False):
        """Create the queue binding on the server.

        :keyword nowait: Do not wait for a reply.

        """
        return _SYN(self.channel.queue_bind, queue=self.name,
                                             exchange=self.exchange.name,
                                             routing_key=self.routing_key,
                                             arguments=self.binding_arguments,
                                             nowait=nowait)
示例#5
0
    def queue_bind(self, nowait=False):
        """Create the queue binding on the server.

        :keyword nowait: Do not wait for a reply.

        """
        return _SYN(self.channel.queue_bind, queue=self.name,
                                             exchange=self.exchange.name,
                                             routing_key=self.routing_key,
                                             arguments=self.binding_arguments,
                                             nowait=nowait)
示例#6
0
    def delete(self, if_unused=False, nowait=False):
        """Delete the exchange declaration on server.

        :keyword if_unused: Delete only if the exchange has no bindings.
            Default is :const:`False`.

        :keyword nowait: If set the server will not respond, and a
            response will not be waited for. Default is :const:`False`.

        """
        return _SYN(self.channel.exchange_delete, exchange=self.name,
                                                  if_unused=if_unused,
                                                  nowait=nowait)
示例#7
0
    def delete(self, if_unused=False, nowait=False):
        """Delete the exchange declaration on server.

        :keyword if_unused: Delete only if the exchange has no bindings.
            Default is :const:`False`.

        :keyword nowait: If set the server will not respond, and a
            response will not be waited for. Default is :const:`False`.

        """
        return _SYN(self.channel.exchange_delete, exchange=self.name,
                                                  if_unused=if_unused,
                                                  nowait=nowait)
示例#8
0
    def recover(self, requeue=False):
        """Redeliver unacknowledged messages.

        Asks the broker to redeliver all unacknowledged messages
        on the specified channel.

        :keyword requeue: By default the messages will be redelivered
          to the original recipient. With `requeue` set to true, the
          server will attempt to requeue the message, potentially then
          delivering it to an alternative subscriber.

        """
        return _SYN(self.channel.basic_recover, requeue=requeue)
示例#9
0
    def recover(self, requeue=False):
        """Redeliver unacknowledged messages.

        Asks the broker to redeliver all unacknowledged messages
        on the specified channel.

        :keyword requeue: By default the messages will be redelivered
          to the original recipient. With `requeue` set to true, the
          server will attempt to requeue the message, potentially then
          delivering it to an alternative subscriber.

        """
        return _SYN(self.channel.basic_recover, requeue=requeue)
示例#10
0
    def declare(self, nowait=False):
        """Declare the exchange.

        Creates the exchange on the broker.

        :keyword nowait: If set the server will not respond, and a
            response will not be waited for. Default is :const:`False`.

        """
        return _SYN(self.channel.exchange_declare, exchange=self.name,
                                                type=self.type,
                                                durable=self.durable,
                                                auto_delete=self.auto_delete,
                                                arguments=self.arguments,
                                                nowait=nowait)
示例#11
0
    def declare(self, nowait=False):
        """Declare the exchange.

        Creates the exchange on the broker.

        :keyword nowait: If set the server will not respond, and a
            response will not be waited for. Default is :const:`False`.

        """
        return _SYN(self.channel.exchange_declare, exchange=self.name,
                                                type=self.type,
                                                durable=self.durable,
                                                auto_delete=self.auto_delete,
                                                arguments=self.arguments,
                                                nowait=nowait)
示例#12
0
    def queue_declare(self, nowait=False, passive=False):
        """Declare queue on the server.

        :keyword nowait: Do not wait for a reply.
        :keyword passive: If set, the server will not create the queue.
            The client can use this to check whether a queue exists
            without modifying the server state.

        """
        return _SYN(self.channel.queue_declare, queue=self.name,
                                                passive=passive,
                                                durable=self.durable,
                                                exclusive=self.exclusive,
                                                auto_delete=self.auto_delete,
                                                arguments=self.queue_arguments,
                                                nowait=nowait)
示例#13
0
    def queue_declare(self, nowait=False, passive=False):
        """Declare queue on the server.

        :keyword nowait: Do not wait for a reply.
        :keyword passive: If set, the server will not create the queue.
            The client can use this to check whether a queue exists
            without modifying the server state.

        """
        return _SYN(self.channel.queue_declare, queue=self.name,
                                                passive=passive,
                                                durable=self.durable,
                                                exclusive=self.exclusive,
                                                auto_delete=self.auto_delete,
                                                arguments=self.queue_arguments,
                                                nowait=nowait)
示例#14
0
    def delete(self, if_unused=False, if_empty=False, nowait=False):
        """Delete the queue.

        :keyword if_unused: If set, the server will only delete the queue
            if it has no consumers. A channel error will be raised
            if the queue has consumers.

        :keyword if_empty: If set, the server will only delete the queue
            if it is empty. If if's not empty a channel error will be raised.

        :keyword nowait: Do not wait for a reply.

        """
        return _SYN(self.channel.queue_delete, queue=self.name,
                                               if_unused=if_unused,
                                               if_empty=if_empty,
                                               nowait=nowait)
示例#15
0
    def delete(self, if_unused=False, if_empty=False, nowait=False):
        """Delete the queue.

        :keyword if_unused: If set, the server will only delete the queue
            if it has no consumers. A channel error will be raised
            if the queue has consumers.

        :keyword if_empty: If set, the server will only delete the queue
            if it is empty. If if's not empty a channel error will be raised.

        :keyword nowait: Do not wait for a reply.

        """
        return _SYN(self.channel.queue_delete, queue=self.name,
                                               if_unused=if_unused,
                                               if_empty=if_empty,
                                               nowait=nowait)
示例#16
0
    def get(self, no_ack=None):
        """Poll the server for a new message.

        Returns the message instance if a message was available,
        or :const:`None` otherwise.

        :keyword no_ack: If set messages received does not have to
            be acknowledged.

        This method provides direct access to the messages in a
        queue using a synchronous dialogue, designed for
        specific types of applications where synchronous functionality
        is more important than performance.

        """
        message = _SYN(self.channel.basic_get, queue=self.name, no_ack=no_ack)
        if message is not None:
            return self.channel.message_to_python(message)
示例#17
0
    def get(self, no_ack=None):
        """Poll the server for a new message.

        Returns the message instance if a message was available,
        or :const:`None` otherwise.

        :keyword no_ack: If set messages received does not have to
            be acknowledged.

        This method provides direct access to the messages in a
        queue using a synchronous dialogue, designed for
        specific types of applications where synchronous functionality
        is more important than performance.

        """
        message = _SYN(self.channel.basic_get, queue=self.name, no_ack=no_ack)
        if message is not None:
            return self.channel.message_to_python(message)
示例#18
0
 def unbind(self):
     """Delete the binding on the server."""
     return _SYN(self.channel.queue_unbind, queue=self.name,
                                         exchange=self.exchange.name,
                                         routing_key=self.routing_key,
                                         arguments=self.binding_arguments)
示例#19
0
 def purge(self, nowait=False):
     """Remove all messages from the queue."""
     return _SYN(self.channel.queue_purge, queue=self.name,
                                           nowait=nowait) or 0
示例#20
0
 def purge(self, nowait=False):
     """Remove all messages from the queue."""
     return _SYN(self.channel.queue_purge, queue=self.name,
                 nowait=nowait) or 0