pedrogarrett

pedrogarrett

Calling Elixir from Ruby

What is the best (or maybe simplest) way to call Elixir functions from Ruby?

I have a Rails application in which we are gradually porting functions in it over to an Elixir application. I could, of course, add Phoenix to the Elixir app and make http/json calls to it, but it seems like there ought to be a more efficient method.

Most Liked

karmajunkie

karmajunkie

This isn’t really an Elixir/Ruby problem so much as a systems integration issue—anything you’d do to integrate two services normally should also apply.

HTTP calls are probably the least problematic as you can treat them synchronously. However if you can handle asynchronicity in the Rails application, then my favorite means of doing this kind of thing is a durable message queue. You’ve got a plethora of choices there ranging from sidekiq-style queues in Redis (and there are at least a couple of options for consuming sidekiq format messages in Elixir) to AMQP servers like RabbitMQ to something hosted like AWS SQS. Treat the functions as command messages and send back a response message from Elixir to be further dealt with by the Rails app.

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New

We're in Beta

About us Mission Statement