Class: CFTools::DEAApps

Inherits:
CF::App::Base
  • Object
show all
Defined in:
lib/tools-cf-plugin/dea-apps.rb

Instance Method Summary collapse

Instance Method Details

#dea_appsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/tools-cf-plugin/dea-apps.rb', line 18

def dea_apps
  @seen_apps = {}

  host = input[:host]
  port = input[:port]
  user = input[:user]
  pass = input[:password]

  NATS.start(:uri => "nats://#{user}:#{pass}@#{host}:#{port}") do
    NATS.subscribe("dea.advertise") do |msg|
      payload = JSON.parse(msg)
      dea_id = payload["id"]
      advertisements[dea_id] = payload["app_id_to_count"]
    end

    EM.add_periodic_timer(3) do
      render_table
    end
  end
end

#preconditionObject



6
# File 'lib/tools-cf-plugin/dea-apps.rb', line 6

def precondition; end