Class: ClusteredRpc::Transport::LocalProcess

Inherits:
Base
  • Object
show all
Defined in:
lib/clustered_rpc/transport/local_process.rb

Instance Method Summary collapse

Methods inherited from Base

#connect, #reconnect, #run_method_from_message, #subscribed?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



15
16
17
# File 'lib/clustered_rpc/transport/local_process.rb', line 15

def method_missing(method, *args)
  raise "LocalProcess cluster attempted to call missing method [#{method}].  Do you have missing Redis configuration?"
end

Instance Method Details

#get_result(request_id) ⇒ Object



11
12
13
# File 'lib/clustered_rpc/transport/local_process.rb', line 11

def get_result(request_id)
  Thread.current[:clustered_pass_through_result]
end

#publish(payload = {}) ⇒ Object



6
7
8
9
# File 'lib/clustered_rpc/transport/local_process.rb', line 6

def publish(payload={})
  result = run_method_from_message(payload)
  Thread.current[:clustered_pass_through_result] = { ClusteredRpc.instance_id => result.to_json}
end