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.



15
16
17
# File 'lib/dispatch-rider/handlers/base.rb', line 15

def raw_message
  @raw_message
end

Class Method Details

.set_default_retry(amount) ⇒ Object



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

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

Instance Method Details

#do_process(raw_message) ⇒ Object



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

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

#process(message) ⇒ Object

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/dispatch-rider/handlers/base.rb', line 27

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