module Shoryuken::Worker::ClassMethods
Public Instance Methods
auto_delete?()
click to toggle source
# File lib/shoryuken/worker.rb, line 38 def auto_delete? !!(get_shoryuken_options['delete'] || get_shoryuken_options['auto_delete']) end
auto_visibility_timeout?()
click to toggle source
# File lib/shoryuken/worker.rb, line 30 def auto_visibility_timeout? !!get_shoryuken_options['auto_visibility_timeout'] end
exponential_backoff?()
click to toggle source
# File lib/shoryuken/worker.rb, line 34 def exponential_backoff? !!get_shoryuken_options['retry_intervals'] end
perform_async(body, options = {})
click to toggle source
# File lib/shoryuken/worker.rb, line 9 def perform_async(body, options = {}) Shoryuken.worker_executor.perform_async(self, body, options) end
perform_in(interval, body, options = {})
click to toggle source
# File lib/shoryuken/worker.rb, line 13 def perform_in(interval, body, options = {}) Shoryuken.worker_executor.perform_in(self, interval, body, options) end
Also aliased as: perform_at
server_middleware() { |_server_chain| ... }
click to toggle source
# File lib/shoryuken/worker.rb, line 19 def server_middleware @_server_chain ||= Shoryuken.server_middleware.dup yield @_server_chain if block_given? @_server_chain end
shoryuken_options(opts = {})
click to toggle source
# File lib/shoryuken/worker.rb, line 25 def shoryuken_options(opts = {}) self.shoryuken_options_hash = get_shoryuken_options.merge(stringify_keys(opts || {})) normalize_worker_queue! end
Private Instance Methods
normalize_worker_queue!()
click to toggle source
# File lib/shoryuken/worker.rb, line 109 def normalize_worker_queue! queue = shoryuken_options_hash['queue'] if queue.respond_to?(:call) queue = queue.call shoryuken_options_hash['queue'] = queue end case shoryuken_options_hash['queue'] when Array shoryuken_options_hash['queue'].map!(&:to_s) when Symbol shoryuken_options_hash['queue'] = shoryuken_options_hash['queue'].to_s end [shoryuken_options_hash['queue']].flatten.compact.each(&method(:register_worker)) end
register_worker(queue)
click to toggle source
# File lib/shoryuken/worker.rb, line 126 def register_worker(queue) Shoryuken.register_worker(queue, self) end