Class: Bosh::Agent::AgentController

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/bosh_agent/http_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(handler) ⇒ AgentController

Returns a new instance of AgentController.



107
108
109
110
# File 'lib/bosh_agent/http_handler.rb', line 107

def initialize(handler)
  super()
  @handler = handler
end

Instance Method Details

#handle_message(json) ⇒ Object



125
126
127
128
129
130
131
132
133
# File 'lib/bosh_agent/http_handler.rb', line 125

def handle_message(json)
  begin
    payload = @handler.handle_message(json)
  rescue => e
    payload = RemoteException.from(e).to_hash
  end

  Yajl::Encoder.encode(payload, :terminator => "\n")
end