Class: Proxy::RemoteExecution::Ssh::MQTT::Dispatcher

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDispatcher

Returns a new instance of Dispatcher.



35
36
37
38
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 35

def initialize
  @supervisor = DispatcherSupervisor.spawn(name: 'RestartingSupervisor', args: [])
  @reference = @supervisor.ask!(:dispatcher_reference)
end

Instance Attribute Details

#referenceObject (readonly)

Returns the value of attribute reference.



34
35
36
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 34

def reference
  @reference
end

Instance Method Details

#done(uuid) ⇒ Object



52
53
54
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 52

def done(uuid)
  reference.tell([:done, uuid])
end

#new(uuid, topic, payload) ⇒ Object



40
41
42
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 40

def new(uuid, topic, payload)
  reference.tell([:new, uuid, topic, payload])
end

#resend(uuid) ⇒ Object



48
49
50
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 48

def resend(uuid)
  reference.tell([:resend, uuid])
end

#running(uuid) ⇒ Object



44
45
46
# File 'lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb', line 44

def running(uuid)
  reference.tell([:running, uuid])
end