lib/bunny/channel.rb in bunny-2.3.1 vs lib/bunny/channel.rb in bunny-2.4.0

- old
+ new

@@ -364,11 +364,11 @@ # Provides access to the default exchange # @see http://rubybunny.info/articles/exchanges.html Exchanges and Publishing guide # @api public def default_exchange - self.direct(AMQ::Protocol::EMPTY_STRING, :no_declare => true) + Exchange.default(self) end # Declares a headers exchange or looks it up in the cache of previously # declared exchanges. # @@ -425,30 +425,10 @@ # @endgroup # @group QoS and Flow Control - # Sets how many messages will be given to consumers on this channel before they - # have to acknowledge or reject one of the previously consumed messages - # - # @param [Integer] prefetch_count Prefetch (QoS setting) for this channel - # @param [Boolean] global - # Whether to use global mode for prefetch: - # - +false+: per-consumer - # - +true+: per-channel - # Note that the default value (+false+) hasn't actually changed, but - # previous documentation described that as meaning per-channel and - # unsupported in RabbitMQ, whereas it now actually appears to mean - # per-consumer and supported - # (https://www.rabbitmq.com/consumer-prefetch.html). - # @see http://rubybunny.info/articles/exchanges.html Exchanges and Publishing guide - # @see http://rubybunny.info/articles/queues.html Queues and Consumers guide - # @api public - def prefetch(count, global = false) - self.basic_qos(count, global) - end - # Flow control. When set to false, RabbitMQ will stop delivering messages on this # channel. # # @param [Boolean] active Should messages to consumers on this channel be delivered? # @api public @@ -647,12 +627,12 @@ # @return [AMQ::Protocol::Basic::QosOk] RabbitMQ response # @see Bunny::Channel#prefetch # @see http://rubybunny.info/articles/queues.html Queues and Consumers guide # @api public def basic_qos(count, global = false) - raise ArgumentError.new("prefetch count must be a positive integer, given: #{prefetch_count}") if count < 0 - raise ArgumentError.new("prefetch count must be no greater than #{MAX_PREFETCH_COUNT}, given: #{prefetch_count}") if count > MAX_PREFETCH_COUNT + raise ArgumentError.new("prefetch count must be a positive integer, given: #{count}") if count < 0 + raise ArgumentError.new("prefetch count must be no greater than #{MAX_PREFETCH_COUNT}, given: #{count}") if count > MAX_PREFETCH_COUNT raise_if_no_longer_open! @connection.send_frame(AMQ::Protocol::Basic::Qos.encode(@id, 0, count, global)) Bunny::Timeout.timeout(wait_on_continuations_timeout, ClientTimeout) do @@ -663,10 +643,11 @@ @prefetch_count = count @prefetch_global = global @last_basic_qos_ok end + alias prefetch basic_qos # Redeliver unacknowledged messages # # @param [Boolean] requeue Should messages be requeued? # @return [AMQ::Protocol::Basic::RecoverOk] RabbitMQ response @@ -1512,9 +1493,10 @@ # Recovery feature. # # @api plugin def recover_confirm_mode if using_publisher_confirmations? + @unconfirmed_set.clear @delivery_tag_offset = @next_publish_seq_no - 1 confirm_select(@confirms_callback) end end