module HireFire::Macro::Deprecated::Bunny::Private
@!visibility private
Public Instance Methods
count_messages(channel, queues, options)
click to toggle source
Counts the number of messages in the specified queues.
@param channel [Bunny::Channel] The channel to interact with RabbitMQ. @param queues [Array<String, Symbol>] The names of the queues to count messages from. @param options [Hash] The options for the queues, including durability and priority settings. @return [Integer] The total number of messages across all specified queues.
# File lib/hirefire/macro/deprecated/bunny.rb, line 73 def count_messages(channel, queues, options) queues.inject(0) do |sum, queue| queue_options = {durable: options[:durable]} queue_options[:arguments] = {"x-max-priority" => options[:"x-max-priority"]} if options.key?(:"x-max-priority") queue = channel.queue(queue.to_s, **queue_options) sum + queue.message_count end end