Class: Surety::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/surety/processor.rb

Class Method Summary collapse

Class Method Details

.performObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/surety/processor.rb', line 6

def self.perform
  message = nil
  puts "[Surety::Processor]: Handling surety message"
  begin
    message = Surety::Message.get_next_for_processing
    puts "[Surety::Processor]: Found message #{message.inspect}"
    message.process if message
  rescue Exception => ex
    puts "[Surety::Processor]: error #{ex.to_s}"
    puts "[Surety::Processor]: #{ex.backtrace.join("\n")}"
    raise ex
  ensure
    sleep 5 if message.nil?
    request_next
  end
    
end

.request_nextObject



24
25
26
# File 'lib/surety/processor.rb', line 24

def self.request_next
  Resque.enqueue(self)
end