Fixes bug

This commit is contained in:
Brusk Awat 2022-12-01 18:44:28 +03:00
parent 77b6151364
commit d19f767cb1
Signed by: broosk1993
GPG Key ID: 5D20F7E02649F74E

View File

@ -5,7 +5,7 @@ namespace :rmq do
task subscriber: :environment do task subscriber: :environment do
Rails.application.eager_load! Rails.application.eager_load!
channels = RabbitCarrots::Configuration.routing_key_mappings.map do |mapping| channels = RabbitCarrots.configuration.routing_key_mappings.map do |mapping|
# This will be supplied in initializer. At that time, the Handler will not be available to be loaded and will throw Uninitialized Constant # This will be supplied in initializer. At that time, the Handler will not be available to be loaded and will throw Uninitialized Constant
{ **mapping, handler_class: mapping[:handler_class].constantize } { **mapping, handler_class: mapping[:handler_class].constantize }
end end
@ -30,7 +30,7 @@ end
def run_task(queue_name:, handler_class:, routing_keys:) def run_task(queue_name:, handler_class:, routing_keys:)
RabbitConnection.instance.channel.with do |channel| RabbitConnection.instance.channel.with do |channel|
exchange = channel.topic(RabbitCarrots::Configuration.event_bus_exchange_name, durable: true) exchange = channel.topic(RabbitCarrots.configuration.event_bus_exchange_name, durable: true)
Rails.logger.info "Listening on QUEUE: #{queue_name} for ROUTING KEYS: #{routing_keys}" 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)