简体   繁体   中英

Java-based JMS frameworks which use websockets as transport

I'm trying to implement bi-directional communication between java-based client and server and the main protocol is JMS. But due to administrative intranet restrictions where client reside it is not possible to have inbound connection. The main idea is to wrap JMS in something HTTP-like. I chose Websockets. The only solution I found is OpenMQ . It supports this. Are there any better solution?

Thanks.

JMS is a way different way of communication compared to websockets. Briefly :

  • Websockets are an implementation of sockets for the Web. A socket is a connection that is made between 2 peers. The connection is on hold, while the peers exchange messages. The connection is maintained during the whole communication and it is closed after the communication has ended.
  • JMS is a Java standard/API for sending messages between 2 or more clients. However, it is differently structured. In JMS, there is an entity called message broker , where messages are sent, stored and then retrieved by the clients. So, this approach can be a distributed environment.

So, JMS is a different approach to Websockets, since JMS is "stateless" and optionally asynchronous, while websockets are stateful and synchronous.

Thus, I think you should not make a choice between those 2, considering only the firewall limitation, but you should be more focused on the context of the 2 approaches, deciding which one is more suitable for your case.

If you believe that JMS is a better solution, then you should alter the firewall rules, so that the port used for JMS (by default 1099) is allowed with specific security limitations. Otherwise, you can use websockets, accepting the performance limitation of synchronous communication.

There is also the approach of integrating websockets with JMS, that is captured by openMQ and other frameworks. However, I do not know what the implications in performance will be compared to simple JMS, and I think that this solution should be chosen, only if we talk about a web application.

Additional Comment

There is also the capability of using HTTP tuneling over JMS. Thus, you will not have to use websockets. You will still use JMS, but there will be a servlet that will be receiving HTTP requests and redirecting them to the JMS service. This has also been implemented in openMQ, as you can see in the tutorial . In this way, you ovveride the firewall restriction, without adding the complexity of websockets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM