Web Socket vs JMS or Activemq

Débora picture Débora · Apr 27, 2014 · Viewed 8.5k times · Source

I want to know what are the differences between Java Web socket and JMS (or ActiveMq) ? Please let me know or have any source having any comparison of WebSocket and JMS and where to use websocket and not to and where to use Activemq instead of websocket please. Activemq is an implementation of JMS. Activemq might use Web socket. What if web socket is used to transfer messages (having any type of data) instead Activemq ? This may depend on the type of application and requirements, how ever as general and to make me easy to get an decision what to use, let me have your ideas(I want to message between two web applications, simply,fast and light weight).

Those who vote to Close : Please think to help, at least let some one to get help, knowledge and not to avoid it.

Answer

Warren Dew picture Warren Dew · Apr 27, 2014

Web sockets are a way of providing two way socket style interfaces between a web browser and a web server, with the server able to push information, rather than only responding to browser HTTP "pull" requests. It sounds from your question and clarifications that that's not what you need.

Plain sockets, however, are a good way of providing synchronous communications between applications. If the application receiving the messages can process them synchronously - as soon as they are sent - regular sockets may be a good solution.

Message queues are intended for asynchronous communications - cases where a message, after being sent, may need to be stored for a while before the recipient picks up the message and acts on it. Because of the need for storage, message queues require a separate server to store the message, or in some cases a database server if you already have one.

Plain sockets are simple, fast, and lightweight; message queues aren't really since they require setting up a separate server. If you need asynchronous message delivery, though, there may be no truly simple, fast, and lightweight solution, so message queues may be the next best thing.