I have made a web-server using node.js, now on my client side (which I have made using java-script), when a user clicks send button, instead of a post request (XMLHttpRequest), I want to send the data to JMS queue. How can I implement that in javascript.
JMS is a Java-only API. There is no way to make JavaScript implement Java-API unless you actually run the JS on top of java (Rhino or whatever). But that does not seems to be the case here.
Theoretically - it's possible to implement a C++ wrapper using JNI to talk to java classes that can use JMS. That wrapper then has to be adapted to Node/V8 extension.. Well, it's a lot of error prone work. Don't go this way.
The solution is not to use JMS. Most JMS implementations (ActiveMQ, IBM WebSphere MQ, etc.) usually have multiple ways to communicate with it. Usually there is a C/C++ client that can be used by a Node.js extension.
There are also standardized wire-protocols that JMS brokers commonly supports that can be used with existing Node.js extensions. AMQP 1.0, MQTT, STOMP. Also, many message brokers have some possibility (addon or similar) to accept messages through HTTP.
So please explore what possible communication methods your JMS implementation has.
As a fallback solution, simply write a small java program that listen to HTTP and produces JMS messages that you can call from your Node.js app.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments