Class: Proxy::RemoteExecution::Ssh::MQTT::DispatcherSupervisor

Inherits:
Concurrent::Actor::RestartingContext
  • Object
show all
Defined in:
lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb

Instance Method Summary collapse

Constructor Details

#initializeDispatcherSupervisor

Returns a new instance of DispatcherSupervisor.



6
7
8
9
10
11
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 6

def initialize
  limit = Proxy::RemoteExecution::Ssh::Plugin.settings[:mqtt_rate_limit]
  @dispatcher = DispatcherActor.spawn('MQTT dispatcher',
                                      Proxy::Dynflow::Core.world.clock,
                                      limit)
end

Instance Method Details

#behaviour_definitionObject

In case an exception is raised during processing, instruct concurrent-ruby to keep going without losing state



26
27
28
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 26

def behaviour_definition
  Concurrent::Actor::Behaviour.restarting_behaviour_definition(:resume!)
end

#on_message(message) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 13

def on_message(message)
  case message
  when :dispatcher_reference
    @dispatcher
  when :resumed
    # Carry on
  else
    pass
  end
end