diff --git a/.rubocop.yml b/.rubocop.yml index d87abcd..00a5aa0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -112,3 +112,5 @@ Metrics/CyclomaticComplexity: Max: 15 Metrics/PerceivedComplexity: Max: 15 +Metrics/ParameterLists: + Max: 6 diff --git a/Gemfile.lock b/Gemfile.lock index f3056ec..1fac58e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rabbit_carrots (1.0.6) + rabbit_carrots (1.1.0) bunny (>= 2.22) connection_pool (>= 2.4) diff --git a/lib/rabbit_carrots/core.rb b/lib/rabbit_carrots/core.rb index ffe7f98..1133fbb 100644 --- a/lib/rabbit_carrots/core.rb +++ b/lib/rabbit_carrots/core.rb @@ -36,6 +36,7 @@ module RabbitCarrots handler_class:, routing_keys: channel[:routing_keys], queue_arguments: channel[:arguments], + exchange_name: channel[:exchange_name], kill_to_restart_on_standard_error: ) end @@ -76,9 +77,9 @@ module RabbitCarrots @running = false end - def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}, kill_to_restart_on_standard_error: false) + def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}, exchange_name: nil, kill_to_restart_on_standard_error: false) RabbitCarrots::Connection.instance.channel.with do |channel| - exchange = channel.topic(RabbitCarrots.configuration.rabbitmq_exchange_name, durable: true) + exchange = channel.topic(exchange_name || RabbitCarrots.configuration.rabbitmq_exchange_name, durable: true) logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}" queue = channel.queue(queue_name, durable: true, arguments: queue_arguments) diff --git a/lib/rabbit_carrots/version.rb b/lib/rabbit_carrots/version.rb index 6fd40c2..c02111d 100644 --- a/lib/rabbit_carrots/version.rb +++ b/lib/rabbit_carrots/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RabbitCarrots - VERSION = '1.0.6' + VERSION = '1.1.0' end