lib/advanced_sneakers_activejob.rb in advanced-sneakers-activejob-0.2.3 vs lib/advanced_sneakers_activejob.rb in advanced-sneakers-activejob-0.3.0

- old
+ new

@@ -1,9 +1,10 @@ # frozen_string_literal: true require 'active_support' require 'active_support/core_ext' +require 'bunny_publisher' require 'sneakers' require 'advanced_sneakers_activejob/workers_registry' Sneakers::Worker.send(:remove_const, :Classes) Sneakers::Worker::Classes = AdvancedSneakersActiveJob::WorkersRegistry.new @@ -13,10 +14,11 @@ require 'advanced_sneakers_activejob/exponential_backoff' require 'advanced_sneakers_activejob/handler' require 'advanced_sneakers_activejob/configuration' require 'advanced_sneakers_activejob/errors' require 'advanced_sneakers_activejob/publisher' +require 'advanced_sneakers_activejob/delayed_publisher' require 'advanced_sneakers_activejob/active_job_patch' require 'advanced_sneakers_activejob/railtie' if defined?(::Rails::Railtie) require 'active_job/queue_adapters/advanced_sneakers_adapter' # Advanced Sneakers adapter for ActiveJob @@ -36,16 +38,20 @@ return const_get(name) if const_defined?(name) klass = Class.new(ActiveJob::QueueAdapters::AdvancedSneakersAdapter::JobWrapper) const_set(name, klass) klass.include Sneakers::Worker - klass.from_queue(queue_name, AdvancedSneakersActiveJob.config.sneakers) + klass.from_queue(queue_name, config.sneakers) klass end def publisher - @publisher ||= AdvancedSneakersActiveJob::Publisher.new + @publisher ||= AdvancedSneakersActiveJob::Publisher.new(config.publisher_config) + end + + def delayed_publisher + @delayed_publisher ||= AdvancedSneakersActiveJob::DelayedPublisher.new(config.publisher_config) end # Based on ActiveSupport::Inflector#parameterize def consumer_name(queue_name:) # replace accented chars with their ascii equivalents