Class: RServiceBus2::SendAtManager
- Inherits:
-
Object
- Object
- RServiceBus2::SendAtManager
- Defined in:
- lib/rservicebus2/sendat_manager.rb
Overview
Send At Manager
Instance Method Summary collapse
- #add(row) ⇒ Object
-
#initialize(bus) ⇒ SendAtManager
constructor
A new instance of SendAtManager.
- #process ⇒ Object
Constructor Details
#initialize(bus) ⇒ SendAtManager
Returns a new instance of SendAtManager.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rservicebus2/sendat_manager.rb', line 6 def initialize(bus) # Check if the SendAt Dir has been specified # If it has, make sure it exists, and is writable string = RServiceBus2.get_value('SENDAT_URI') string = 'file:///tmp/rservicebus-sendat' if string.nil? uri = URI.parse(string) @sendat_storage = SendAtStorage.get(uri) @bus = bus end |
Instance Method Details
#add(row) ⇒ Object
29 30 31 |
# File 'lib/rservicebus2/sendat_manager.rb', line 29 def add(row) @sendat_storage.add(row) end |
#process ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rservicebus2/sendat_manager.rb', line 18 def process now = DateTime.now @sendat_storage.get_all.each_with_index do |row, idx| next if row['timestamp'] <= now @bus._send_needs_wrapping(row['msg'], row['queue_name'], row['correlation_id']) @sendat_storage.delete(idx) end end |