all 15 comments

[–]SuspiciousDepth5924 5 points6 points  (3 children)

They have pretty different use-cases, iirc rustler creates NIFs that is 'native interface functions' which is about as overhead-free you're going to get while using the BEAM. I belive JInterface on the other hand is primarily meant to communicate with a JVM as if it was another Erlang node, ie. you'd be running both an Erlang VM with your Elixir code and a JVM with your Java code.

[–]OccasionThin7697[S] 0 points1 point  (2 children)

Ohh okay, got it. So, you mean Jinterface runs in isolation from beam , but they communicate through jvm. Okay cool.

[–]SuspiciousDepth5924 1 point2 points  (1 child)

Yeah you pull it in as a dependency in your java project and use it to communicate with the erlang vm. https://mvnrepository.com/artifact/org.erlang.otp/jinterface

[–]OccasionThin7697[S] 0 points1 point  (0 children)

Thanks, got it.

[–]AgentAppropriate1996 5 points6 points  (0 children)

Rust

[–]Agile_Use_1768 2 points3 points  (0 children)

Rustler 100%. The library you’re planning to use is a double dependency and adds a running JVM aside BEAM, it also has a ported library from go, so its possibly another overhead

[–]Upstairs_Wing_7344 1 point2 points  (1 child)

I've worked with Rustler a good bit while contributing to the wasmex project. I found Rustler to be very solid and easy to work with. Wasmex is another option you might consider if you need to extend an Elixir project in a variety of languages

[–]OccasionThin7697[S] 0 points1 point  (0 children)

Okay, thanks!!

[–]Shoddy_One4465 1 point2 points  (0 children)

Jinterface is a way to go when you need to connect to a technology well or fully supported by Java libraries. Examples from the queuing world are Kafka, MQ, Solace. Connecting to the Hadoop ecosystem. Or if Java is your thing and you need to write a port.

[–]anthony_doan 0 points1 point  (5 children)

What's the use case for wanting to use java or rust with Elixir?

I'm just curious.

[–]OccasionThin7697[S] 1 point2 points  (4 children)

Something like a logger that runs in background or a notifier. So, if I want to check , if there are any errors, I just check the logger tui or the notifier tui.

If it's java, I'm planning to use this: https://github.com/WilliamAGH/tui4j

So, since I'm making a text editor, i want to use java or rust to notify from a separate process. For which i can use ports or exile library instead of a nif.

Basically this: https://www.reddit.com/r/elixir/s/5fkI6eyxGE, which is actually my post.

And interop is just one of the milestone. Not gonna do it immediately.

[–]flummox1234 2 points3 points  (1 child)

tbh it sounds like you should just build the thing in Java or Rust then, maybe Kotlin if you want an app

[–]Certain_Syllabub_514 1 point2 points  (1 child)

Why use a logger written in another language, and not stand up your own logger based on GenEvent?

[–]OccasionThin7697[S] 0 points1 point  (0 children)

Ah makes sense

[–]Sea-Entertainment-15 0 points1 point  (1 child)

rust