Class: Miu::RPC::Client

Inherits:
Object
  • Object
show all
Includes:
Celluloid::ZMQ
Defined in:
lib/miu/rpc/client.rb

Defined Under Namespace

Classes: Evaluator

Instance Method Summary collapse

Constructor Details

#initialize(address) ⇒ Client

Returns a new instance of Client.



23
24
25
26
27
# File 'lib/miu/rpc/client.rb', line 23

def initialize(address)
  @socket = DealerSocket.new
  @socket.connect address
  @evaluator = Evaluator.new @socket
end

Instance Method Details

#call(method, *args) ⇒ Object



33
34
35
36
37
# File 'lib/miu/rpc/client.rb', line 33

def call(method, *args)
  @evaluator.call method, *args
rescue Exception => e
  abort e
end

#closeObject



29
30
31
# File 'lib/miu/rpc/client.rb', line 29

def close
  @socket.close
end

#notify(method, *args) ⇒ Object



39
40
41
42
43
# File 'lib/miu/rpc/client.rb', line 39

def notify(method, *args)
  @evaluator.notify method, *args
rescue Exception => e
  abort e
end