diff --git a/lib/rabbit_carrots/tasks/rmq.rake b/lib/rabbit_carrots/tasks/rmq.rake index 6706b7b..a8c5830 100644 --- a/lib/rabbit_carrots/tasks/rmq.rake +++ b/lib/rabbit_carrots/tasks/rmq.rake @@ -5,10 +5,12 @@ namespace :rabbit_carrots do task eat: :environment do Rails.application.eager_load! + # rubocop:disable Lint/ConstantDefinitionInBlock DatabaseAgonsticNotNullViolation = defined?(ActiveRecord) ? ActiveRecord::NotNullViolation : RabbitCarrots::EventHandlers::Errors::PlaceholderError DatabaseAgonsticConnectionNotEstablished = defined?(ActiveRecord) ? ActiveRecord::ConnectionNotEstablished : Mongo::Error::SocketError DatabaseAgnosticRecordInvalid = defined?(ActiveRecord) ? ActiveRecord::RecordInvalid : Mongoid::Errors::Validations - + # rubocop:enable Lint/ConstantDefinitionInBlock + 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 { **mapping, handler: mapping[:handler].constantize } @@ -32,7 +34,7 @@ namespace :rabbit_carrots do end end -def run_task(queue_name:, queue_arguments: {}, handler_class:, routing_keys:) +def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {}) RabbitCarrots::Connection.instance.channel.with do |channel| exchange = channel.topic(RabbitCarrots.configuration.event_bus_exchange_name, durable: true)