I work with several commercial products that only offer SDKs for Java, .NET and, sometimes, C++. I do not see any of them offering an Elixir SDK any time soon. So, I was thinking: if I still need to develop my applications to integrate with these products, what should be the best approach?
Forget about Elixir and just use one of the languages as of the SDKs availability?
Build specific small modules in the language of the chosen SDK and have them pass information back and forth ? E.g.: myElixirApp <–> midleware module <–> SDK <–> Product.
Rebuild the SDK functions I want to use in Elixir.
I am not sure how much of a void point this question is (I mentioned previously in another post I am a telecom guy just trying to make some sense of the dev way of doing things).
In any case, is there a standard way of dealing with this type of situation ?
I had not seen JInterface, I think it would take me in the right path. I found this article from Paolo that explains well the process of how to get started.
I chose option 2. The SDK I work with expose C headers, I can’t stand writing C so I write my wrapper program in modern C++, Elixir runs those programs (think unix philosophy) via port. I tried NIF first but I don’t want to take the risk of crashing. I didn’t want to bring in boost either for c node, so that didn’t leave much choices.
if it is a Java SDK, I’d use the erlang-built-in jinterface to make a Java BEAM Node (it pretends to be a node in the elixir/beam/evm mesh).
If it is a C/C++ SDK I’d use either a port or a C/C++ Node.
The Port method is slightly faster in communication, but the Node method is safer and has a lot more power, you can make such an sdk feel very native that way with fairly little code.
Interesting point, I also do have a C++ SDK which I actually feel more comfortable working with (for the only reason that my knowledge of Java is much more limited than my working confidence with C/C++). I am not yet familiar with Ports and Nodes in Elixir / Erlang, I shall look into that,