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

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40042 209
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
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

We're in Beta

About us Mission Statement