class ActiveJob::QueueAdapters::AdvancedSneakersAdapter
Active Job advanced Sneakers
adapter¶ ↑
A high-performance RabbitMQ background processing framework for Ruby. Sneakers
is being used in production for both I/O and CPU intensive workloads, and have achieved the goals of high-performance and 0-maintenance, as designed.
Read more about Sneakers
here.
To use the advanced Sneakers
adapter set the queue_adapter config to :advanced_sneakers
.
Rails.application.config.active_job.queue_adapter = :advanced_sneakers
Private Class Methods
build_publish_params(job)
click to toggle source
# File lib/active_job/queue_adapters/advanced_sneakers_adapter.rb, line 49 def build_publish_params(job) params = merged_publish_options(job) unless params.key?(:routing_key) params[:routing_key] = job.queue_name.respond_to?(:call) ? job.queue_name.call : job.queue_name end params end
merged_publish_options(job)
click to toggle source
# File lib/active_job/queue_adapters/advanced_sneakers_adapter.rb, line 59 def merged_publish_options(job) publish_options = job.class.publish_options.deep_dup || {} publish_options.each do |key, value| publish_options[key] = value.call(job) if value.respond_to?(:call) end publish_options.deep_merge!(job.publish_options) if job.publish_options.present? publish_options end
publish_params(job)
click to toggle source
# File lib/active_job/queue_adapters/advanced_sneakers_adapter.rb, line 40 def publish_params(job) @monitor.synchronize do [ Sneakers::ContentType.serialize(job.serialize, AdvancedSneakersActiveJob::CONTENT_TYPE), build_publish_params(job).merge(content_type: AdvancedSneakersActiveJob::CONTENT_TYPE) ] end end