mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-22 22:06:40 +00:00
Add exchange_name parameter to task configuration and update exchange initialization logic
This commit is contained in:
parent
ac06deb86a
commit
4af3fe56fa
@ -35,6 +35,7 @@ module RabbitCarrots
|
|||||||
queue_name: channel[:queue],
|
queue_name: channel[:queue],
|
||||||
handler_class:,
|
handler_class:,
|
||||||
routing_keys: channel[:routing_keys],
|
routing_keys: channel[:routing_keys],
|
||||||
|
exchange_name: channel[:exchange_name],
|
||||||
queue_arguments: channel[:arguments],
|
queue_arguments: channel[:arguments],
|
||||||
kill_to_restart_on_standard_error:
|
kill_to_restart_on_standard_error:
|
||||||
)
|
)
|
||||||
@ -78,7 +79,7 @@ module RabbitCarrots
|
|||||||
|
|
||||||
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: {}, 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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user