Class: DispatchRider::Handlers::Base

Inherits:
Object
  • Object
show all
Extended by:
InheritanceTracking
Includes:
NamedProcess
Defined in:
lib/dispatch-rider/handlers/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from InheritanceTracking

inherited, subclasses

Methods included from NamedProcess

#with_named_process

Instance Attribute Details

#raw_messageObject (readonly)

Returns the value of attribute raw_message.



17
18
19
# File 'lib/dispatch-rider/handlers/base.rb', line 17

def raw_message
  @raw_message
end

Class Method Details

.set_default_retry(amount) ⇒ Object



10
11
12
13
14
# File 'lib/dispatch-rider/handlers/base.rb', line 10

def set_default_retry( amount )
  define_method(:retry_timeout) do
    amount
  end
end

Instance Method Details

#do_process(raw_message) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/dispatch-rider/handlers/base.rb', line 19

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 retry_on_failure?
  raise e
end

#process(message) ⇒ Object

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/dispatch-rider/handlers/base.rb', line 29

def process(message)
  raise NotImplementedError, "Method 'process' not overridden in subclass!"
end