Class: RServiceBus::SendAtManager

Inherits:
Object
  • Object
show all
Defined in:
lib/rservicebus/SendAtManager.rb

Instance Method Summary collapse

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

#ProcessObject



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