Elixir - Starting a Java JInterface OTP node under supervision

336 Views Asked by At

I have an elixir umbrella project where one of the apps sends requests to a Java app that I have exposed as something similar to an OTP process using JInterface.

It works perfectly because the JInterface library that ships with Erlang makes it easy.

My problem is that I need to be able to stop and start my JInterface process in my umbrella app and I can't find any documentation that shows how to do it. I currently have to execute the jar manually.

Please can somebody explain / point me towards documentation showing how I can execute my jar from within elixir under supervision?

I have tried for so long to find out how to do this but I can only find docs on how to use JInterface and how to interface with it but not how to start it programatically under supervision. Thanks in advance.

1

There are 1 best solutions below

1
Brujo Benavides On BEST ANSWER

A long time ago I had to do just that, and the result was lucene_server. You can find code for node monitoring here. Something along the lines of…

true = link(process()),
true = erlang:monitor_node(State#state.java_node, true),

Another thing that you might find useful (from the Java side) is to use jinerface_stdlib