Module: Broker::Event
- Included in:
- Poller
- Defined in:
- lib/broker/launcher.rb
Instance Method Summary collapse
Instance Method Details
#register(arr) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/broker/launcher.rb', line 8 def register(arr) arr || return puts "Event has been registered with: #{arr.inspect}" unless arr.empty? begin session = Broker::Import.new(:app => Broker.any_app) rescue ArgumentError => e @failed = true puts "Cant login to QB, invalid app name" puts e. end @failed || transport(session) end end |
#transport(session) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/broker/launcher.rb', line 24 def transport(session) while !@queue.empty? payload = @queue.next results = payload.commit(session) results ? @queue.success(payload) : @queue.failure(payload) # Need to handle failure and add payload to queues failed # Need to handle success and move file out and alert queue end puts "Session Terminated: #{session.sign_out}" puts "****************************" puts "Queue Status" puts "****************************" puts "Processed: #{@queue.processed}" puts "Pending: #{@queue.pending.inspect}" puts "Failed: #{@queue.failed.inspect}" puts "****************************" end |