I want to let a Ru开发者_如何学JAVAby app spawn an Erlang process and let it report back to Ruby. Until now I looked into Erlectricity, but couldn't figure out a way to achieve this without letting Erlang spawn Ruby again, which would be a bit messy I guess.
What other ways are there? *MQ? Sockets? What do you think fits best with a single app, talking to a single Erlang process? It really doesn't have to scale (yet).
I use Ruby Open4.popen4
to spawn escript
process which reads from stdin
and writes to stdout
with simple serialization (another option is to use escript params to pass data to Erlang). Escript in turn has full native access to distributed Erlang nodes. Not a rocket science, but it works and much easier to implement than sockets.
You could look into using Ernie. It's an RPC mechanism that makes it pretty easy to talk between Ruby and Erlang (and other languages if you install additional modules).
Thrift supports both Erlang and Ruby:
Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml.
Also, this question might be a duplicate of this and that.
精彩评论