mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-22 22:06:40 +00:00
Merge pull request #14 from arikarim/multi-exchange-
feat: Add exchange_name parameter to run_task method and update Ruboc…
This commit is contained in:
commit
5d2e2df8d2
@ -112,3 +112,5 @@ Metrics/CyclomaticComplexity:
|
|||||||
Max: 15
|
Max: 15
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 15
|
Max: 15
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
Max: 6
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
rabbit_carrots (1.0.6)
|
rabbit_carrots (1.1.0)
|
||||||
bunny (>= 2.22)
|
bunny (>= 2.22)
|
||||||
connection_pool (>= 2.4)
|
connection_pool (>= 2.4)
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ module RabbitCarrots
|
|||||||
handler_class:,
|
handler_class:,
|
||||||
routing_keys: channel[:routing_keys],
|
routing_keys: channel[:routing_keys],
|
||||||
queue_arguments: channel[:arguments],
|
queue_arguments: channel[:arguments],
|
||||||
|
exchange_name: channel[:exchange_name],
|
||||||
kill_to_restart_on_standard_error:
|
kill_to_restart_on_standard_error:
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -76,9 +77,9 @@ module RabbitCarrots
|
|||||||
@running = false
|
@running = false
|
||||||
end
|
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|
|
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}"
|
logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}"
|
||||||
queue = channel.queue(queue_name, durable: true, arguments: queue_arguments)
|
queue = channel.queue(queue_name, durable: true, arguments: queue_arguments)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module RabbitCarrots
|
module RabbitCarrots
|
||||||
VERSION = '1.0.6'
|
VERSION = '1.1.0'
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user