Class: OnesnooperServer::Datagrams::SuccessDatagram

Inherits:
OnesnooperServer::Datagram show all
Defined in:
lib/onesnooper_server/datagrams/success_datagram.rb

Overview

Handles processing of datagrams with SUCESS monitoring messages. Performs 'save' operation on the backend.

Instance Method Summary collapse

Methods inherited from OnesnooperServer::Datagram

#initialize

Constructor Details

This class inherits a constructor from OnesnooperServer::Datagram

Instance Method Details

#run(deferred_callback) ⇒ Object


5
6
7
8
9
10
11
12
13
14
# File 'lib/onesnooper_server/datagrams/success_datagram.rb', line 5

def run(deferred_callback)
  ::EventMachine.defer do
    if parse_payload! && store_all!
      deferred_callback.succeed "Successful monitoring result was " \
                                "recorded in #{store_info.join(', ')}"
    else
      deferred_callback.fail "Processing partially or completely failed, see logs"
    end
  end
end