lib/rabbit_carrots/tasks/rmq.rake in rabbit_carrots-0.1.17 vs lib/rabbit_carrots/tasks/rmq.rake in rabbit_carrots-0.1.18

- old
+ new

@@ -16,25 +16,25 @@ channels.each do |channel| handler_class = channel[:handler] raise "#{handler_class.name} must respond to `handle!`" unless handler_class.respond_to?(:handle!) - run_task(queue_name: channel[:queue], handler_class:, routing_keys: channel[:routing_keys]) + run_task(queue_name: channel[:queue], handler_class:, routing_keys: channel[:routing_keys], queue_arguments: channel[:arguments]) end # Infinite loop to keep the process running loop do sleep 1 end end end -def run_task(queue_name:, handler_class:, routing_keys:) +def run_task(queue_name:, queue_arguments: {}, handler_class:, routing_keys:) RabbitCarrots::Connection.instance.channel.with do |channel| exchange = channel.topic(RabbitCarrots.configuration.event_bus_exchange_name, durable: true) Rails.logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}" - queue = channel.queue(queue_name, durable: true) + queue = channel.queue(queue_name, durable: true, arguments: queue_arguments) routing_keys.map(&:strip).each { |k| queue.bind(exchange, routing_key: k) } queue.subscribe(block: false, manual_ack: true, prefetch: 10) do |delivery_info, properties, payload| Rails.logger.info "Received from queue: #{queue_name}, Routing Keys: #{routing_keys}"