superfly/fly_rpc_elixir

Support RPC to another apps

fedeotaran opened this issue · 2 comments

Hello! Today we are using fly_rpc_elixir via fly_postgres_elixir and it works great!

But we have a function that calls another application within the same organization. We create a normal REST API to communicate them, but we plan to use RPC instead. Maybe this library can also make this job easier.

What do you think?

In order to make that work, you'll need to have the two different applications clustered together. That won't happen automatically and they'll need to share the same BEAM cookie.

The focus of the fly_rpc library is to make it easy to perform an RPC call to the same application in a desired Fly region. You would need to track which node represented which application and possibly include it's region if that's relevant.

It sounds like it's outside the scope of what fly_rpc is built to do.

Once you know the node you want to connect with, performing the RPC call isn't difficult. https://github.com/superfly/fly_rpc_elixir/blob/main/lib/fly_rpc.ex#L123

I think using a REST interface makes the most sense for applications with light integration or where they aren't directly related.

If you have two Elixir applications where one is a service to the other and the dependency primarily goes one direction, then I'd consider bringing the application into an Umbrella app. Then the code is present and usable.

Really, I think it depends. 🙂

Oh! great. Thank you very much for the reply. It helps a lot.
It makes a lot of sense!
Maybe having an Umbrella app makes a lot of sense in our case.

Thanks! 😄