Send to Java Queue JMS

We need to send files into a Java based Messaging Queue via JMS. So far I had no luck finding a library or instructions on how to post a message via JMS.
Did I Overlook an obvious way to do so or is there a library that I could use?
Thanks in advance for your help

JMS is a Java API, so you can’t use it in Elixir. What is the actual product you are using? Most of them support multiple protocols. ActiveMQ for example supports AMQP and STOMP, both of which have BEAM clients.

Well, should be possible through jinterface.

Aside of that, on the Wikipedia page about JMS RabbitMQ is listed as a provider implementation… Perhaps @seb5law can find some hints in rabbits source code?

Yes, but then he would be writing a Java program that had a convenient way to talk to an Elixir program. He wouldn’t be using JMS in Elixir.

Never actually used jinterface, only now about its existence, but I always assumed it were similar to how one does create NIF bindings to C-ABI compatible libraries…

Writing small wrapping functions that will wrap from erlang types to the target types and back…

At least the OP were able to use the JMS through the jinterface one way or the other…

No, its more like erl_connect, which is used to build “C Nodes”. Jinterface is used to build “J Nodes”. I’d only do this if there was absolutely no other way as now you’ve introduced a whole separate server process to manage, just to talk to another server.

The link you posted tells you this upfront:

JMS is not a message or wire format so much as it is a Java client API, and all the message broker products that implement it also implement other protocols.

Okay, thanks @jeremyjh. To describe the problem at hand a bit:

We have a system that stores product. That system exports changes of a products data as a XML file on its host. Currently that message needs to be sent to five recipients, all Java based queues. The senders are currently externally developed java ‘snippets’ that they call JMS senders. Now we have to send these messages to three more recipients, all Java based queues.

Rather than letting the next three senders (that’s really what the external developers would do and charge for) be implemented in Java for a lot of money and a few other drawbacks, we want to use our own queue (e.g. RabbitMQ). To which we will enqueue the XML file into eight queues and handle the sending to the eight recipients. The recipients do not want to change anything in their queues and thus only support the JMS API.

Any thoughts on a better approach or a way to communicate with this JMS API via Elixir?

I think you could use Rabbit to bridge to the JMS queues. And then just use the Elixir amqp client to talk to Rabbit. But if you have no other use for Rabbit than to be this bridge and have never managed a Rabbit server before you are bringing in some accidental complexity. Next to which just writing a Java program to look for these XML files or accept them in an HTTP payload and push them into the queue seems a bit much.

1 Like

Thank you for your advice. RabbitMQ and the JMS Client plugin should work for us.