Method: Bunny::Channel#prefetch
- Defined in:
- lib/bunny/channel.rb
#prefetch ⇒ AMQ::Protocol::Basic::QosOk
Controls message delivery rate using basic.qos AMQP 0.9.1 method.
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# File 'lib/bunny/channel.rb', line 890 def basic_qos(prefetch_count, global = false) raise ArgumentError.new("prefetch count must be a positive integer, given: #{prefetch_count}") if prefetch_count < 0 raise ArgumentError.new("prefetch count must be no greater than #{MAX_PREFETCH_COUNT}, given: #{prefetch_count}") if prefetch_count > MAX_PREFETCH_COUNT raise_if_no_longer_open! @connection.send_frame(AMQ::Protocol::Basic::Qos.encode(@id, 0, prefetch_count, global)) with_continuation_timeout do @last_basic_qos_ok = wait_on_continuations end raise_if_continuation_resulted_in_a_channel_error! @prefetch_count = prefetch_count @prefetch_global = global @last_basic_qos_ok end |