Class: RServiceBus::SendAtManager
- Inherits:
-
Object
- Object
- RServiceBus::SendAtManager
- Defined in:
- lib/rservicebus/SendAtManager.rb
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.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rservicebus/SendAtManager.rb', line 8 def initialize( bus ) #Check if the SendAt Dir has been specified #If it has, make sure it exists, and is writable string = RServiceBus.getValue('SENDAT_URI') if string.nil? then string = 'file:///tmp/rservicebus-sendat' end uri = URI.parse( string ) @SendAtStorage = SendAtStorage.Get( uri ) @Bus = bus end |
Instance Method Details
#Add(row) ⇒ Object
34 35 36 |
# File 'lib/rservicebus/SendAtManager.rb', line 34 def Add( row ) @SendAtStorage.Add( row ) end |
#Process ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/rservicebus/SendAtManager.rb', line 24 def Process now = DateTime.now @SendAtStorage.GetAll.each_with_index do |row,idx| if row['timestamp'] > now then @Bus._SendNeedsWrapping( row['msg'], row['queueName'], row['correlationId'] ) @SendAtStorage.Delete( idx ) end end end |