Calling Erlang from Ruby (Teaser)
So someone has come up with a solution for linking Erlang to ruby. This could be potentially useful.
The original article: Calling Erlang from Ruby (Teaser)
The library is called Rebar (Ruby to Erlang Bridge And Runner). Rebar has two parts: an Erlang server and a Ruby client. The server listens for JSON-RPC requests, calls the specified Erlang function, and responds with a JSON-RPC response. The Ruby client object simply accepts any method name, captures it with method_missing, wraps everything up in a JSON-RPC request, fires it off, waits for the response, and then extracts the result out of the JSON-RPC response, returning it like a normal Ruby call.
Unfortunately this means that you’re going to be waiting for both RPC, parsing, routing, and method_missing in ruby. Thus the ‘teaser’ I would say.
Erlang also has some powers of reflection though. A better solution for some applications would be to publish a dsl between them for the particular application. Maybe even a full object dsl. Depending on how much meta-information can be made available to each side, this direction may get faster.
I think the most reliable way would involve generating the protocol API for the RPC from ruby written generators. This should have the advantage of adding a fully ruby DSL. I’m starting to discuss a design that looks more like ruby2erlang now though. I guess maybe it’s not /that/ hard.
Anyway, this could solve a number of problems relatively trivially for scaling networked apps, with erlang handling buffering and non-blocking high concurrency jam, and ruby based ‘consumers’ (which it’s worth noting could live anywhere, which is not completely uncommon for such high load scenarios).
Anyway, this is really just another thing for my already very long list of ideas I’d like to give some attention :)