class Rcom::Response
Attributes
channel[R]
node[R]
server[R]
Public Class Methods
new(params)
click to toggle source
# File lib/rcom/rpc.rb, line 31 def initialize(params) @node = params[:node] @channel = params[:channel] @server = params[:server] end
Public Instance Methods
send_method(method, args)
click to toggle source
# File lib/rcom/rpc.rb, line 60 def send_method(method, args) begin server.send(method, args) rescue return nil end end
serve()
click to toggle source
# File lib/rcom/rpc.rb, line 37 def serve begin loop do ch, request = node.brpop(channel) message = MessagePack.unpack( request, symbolize_keys: true ) response = send_method( message[:method], message[:args] ) node.rpush(message[:id], response.to_msgpack) end rescue sleep 1 retry rescue Interrupt => _ end end