Class: RemoteService::Service

Inherits:
Base
  • Object
show all
Includes:
Singleton
Defined in:
lib/remote_service/service.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

queue_name

Class Method Details

.start(brokers, workers = 16) ⇒ Object



28
29
30
31
32
33
# File 'lib/remote_service/service.rb', line 28

def start(brokers, workers=16)
  queue = Queue.instance
  queue.connect(brokers) do
    queue.service(self.instance, workers)
  end
end

Instance Method Details

#handle(payload, reply_to) ⇒ Object



7
8
9
10
11
# File 'lib/remote_service/service.rb', line 7

def handle(payload, reply_to)
  result = method(payload['action'].to_sym).call(*prepare_params(payload['params']))
  RemoteService.logger.debug "RESULT - ACTION:[#{payload['action']}] REPLY_TO:[#{reply_to}] PARAMS:[#{payload['params']}] RESULT:[#{result}]"
  respond_with_result(reply_to, result)
end