rinterface: a pure Ruby client to talk to Erlang
Dave Bryson - daveb - May 21, 2009After digging through the jinterface code for the past couple of evenings I finally have a working Ruby client that can make RPC calls to an Erlang node. Although the code is a bit rough right now, it works.
I’m hoping to evolve it into a full Ruby node with capabilities similar to jinterface (the java implementation included with the Erlang).
The current implementation has a few limitations:
- The Erlang node and Ruby client must be running on the same machine. This will not be hard to change
- The Erlang process must have a registered name
Essentially right now it works a lot like the native rpc:call in Erlang.
Here’s an example of a Ruby client calling a Erlang process called ‘math’:
EM.run do
# Connect to epmd to get the port of 'math'.
# 'math' is the -sname of the erlang node
epmd = EpmdConnection.lookup_node("math")
epmd.callback do |port|
puts "got the port #{port}"
# make the rpc call to 'math' on port for
# mod 'math_server' on fun 'add' with args
node = Node.rpc_call("math",port.to_i,
"math_server",
"add",[10,20])
node.callback{ |result|
puts "Sum is: #{result}"
EM.stop
}
node.errback{ |err|
puts "Error: #{err}"
EM.stop
}
end
epmd.errback do |err|
puts "Error: #{err}"
EM.stop
end
end
You can check out the code here: rinterface
Categories: Blogs Dave Bryson
Comments
the past couple of 640-802 evenings I finally SY0-301 have a working Ruby client that can make RPC calls to an Erlang node.70-680 Although the code is a bit rough right now, it works.
Posted by roter on 05 Oct 2011 at 11:19
Add comment
Erlang on Twitter
» mshiba64 (Masami Shibatani): ということで、ErlangのBit Syntaxに突入。language for distributed and concurrent programだからね。
» despenjahatdos (Jon champion): Eits jangan salah begini2 saya titisan dewa erlang RT @yolapitalokaa: Yg ngepost twit kyknya jg lg galau drtd ... http://t.co/QfCyVSIl
» erlangtriaji (erlang triaji ): Sini sun ahahaha RT @Encays: Udah udah, lo berduaan aja RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aj
» Encays (antarif cahyadi): Menjepit RT @erlangtriaji: Tegang! RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh
» erlangtriaji (erlang triaji ): Tegang! RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama banget
» Encays (antarif cahyadi): Udah udah, lo berduaan aja RT @revianh: Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama
» revianh (Revian Hermansyah): Kepooo! RT @erlangtriaji: Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama banget -_-
» erlangtriaji (erlang triaji ): Hadir RT @Encays: Udah, sama erlang aja RT @revianh: Nanggepnya lama banget -_-
» Encays (antarif cahyadi): Udah, sama erlang aja RT @revianh: Nanggepnya lama banget -_-
» mshiba64 (Masami Shibatani): Erlangではシリアライズはterm_to_binaryというBuilt-in-functionで実行される。画像データもErlangで扱われるいくつかのTermも全てBinary型に可逆変換できる。
Statistics
Number of aggregated posts: 10454
Number of comments: 1392
Most recent article: January 31, 2012
Latest comments
» nobelboy on OpaDo Data Storage: Feel free to add some Qs here or contact me offline, and I will see what I can work into…
» darrensy on The Twisted Matrix: This has been a great idea you have shared. covers for kindle
» jony on Principle Software Engineer at LonoCloud (Full-time): That provides will become a internet marketer of little kinds of expert methods developers developing strategy using Erlang/OTP. There will…