examples/control.rb in agent99-0.0.3 vs examples/control.rb in agent99-0.0.4

- old
+ new

@@ -2,25 +2,34 @@ # control.rb require_relative '../lib/agent99' class Control < Agent99::Base - TYPE = :hybrid + # this information is made available when the agent + # registers with the central registry service. It is + # made available during the discovery process. + # + def info + { + name: self.class.to_s, + type: :hybrid, + capabilities: ['control', 'headquarters', 'secret underground base'], + # request_schema: ControlRequest.schema, + # response_schema: {}, # Agent99::RESPONSE.schema + # control_schema: {}, # Agent99::CONTROL.schema + # error_schema: {}, # Agent99::ERROR.schema + } + end attr_accessor :statuses def init @agents = @registry_client.fetch_all_agents @statuses = {} end - def capabilities - ['control', 'headquarters', 'secret underground base'] - end - - def send_control_message(message:, payload: {}) @agents.each do |agent| response = @message_client.publish( header: { to_uuid: agent[:uuid], @@ -46,10 +55,10 @@ send_control_message(message: 'resume') end def stop_all - send_control_message(message: 'stop') + send_control_message(message: 'shutdown') end def get_all_status @statuses.clear # Reset statuses before new request