Sha256: eca22a3a6895630199f1b956479712d286f0aeddf877aff43a2ccc8d70b6f196
Contents?: true
Size: 1.17 KB
Versions: 25
Compression:
Stored size: 1.17 KB
Contents
module DispatchRider module Handlers class Base include NamedProcess extend InheritanceTracking class << self def set_default_retry( amount ) define_method(:retry_timeout) do amount end end end attr_reader :raw_message def do_process(raw_message) with_named_process(raw_message) do @raw_message = raw_message process(raw_message.body) end rescue Exception => e self.retry if self.retry_on_failure? raise e end def process(message) raise NotImplementedError, "Method 'process' not overridden in subclass!" end protected def extend_timeout(timeout) raw_message.extend_timeout(timeout) end def return_to_queue raw_message.return_to_queue end def retry timeout = retry_timeout case timeout when :immediate return_to_queue else extend_timeout(timeout) end end def retry_on_failure? self.respond_to? :retry_timeout end end end end
Version data entries
25 entries across 25 versions & 1 rubygems