Class: Surety::Message
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Surety::Message
- Defined in:
- lib/surety/message.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.generate_message(message_content) ⇒ Object
22 23 24 |
# File 'lib/surety/message.rb', line 22 def self.() self.create(:message_content=>) end |
.get_next_for_processing ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/surety/message.rb', line 26 def self.get_next_for_processing = nil ActiveRecord::Base.transaction do = self.needs_processing.first .begin_processing! if end end |
Instance Method Details
#process ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/surety/message.rb', line 63 def process begin Surety::Configuration..process(self) self.complete_processing! rescue Exception => ex self.last_exception = ex self.fail_processing! raise ex end end |
#record_completion ⇒ Object
74 75 76 77 |
# File 'lib/surety/message.rb', line 74 def record_completion self.completed_at = Time.now self.last_exception = nil end |
#record_failure ⇒ Object
79 80 81 82 |
# File 'lib/surety/message.rb', line 79 def record_failure self.failed_at = Time.now self.failure_count = self.failure_count+1 end |
#reserve ⇒ Object
58 59 60 61 |
# File 'lib/surety/message.rb', line 58 def reserve self.processing_started_at = Time.now self.processing_attempt_count = self.processing_attempt_count+1 end |