The Difference Between JMS and WebSockets
During the 22nd Airhacks Questions and Answers I got an interesting question:
What Is The Difference Between JMS and WebSockets?
JSR 368: JavaTM Message Service 2.1 (JMS) comes with Java EE and covers both: Point-to-Point as well as Publish-Subscribe protocols. However: JMS is only an Java EE Application Programmer Interface (API) which is implemented by various Messaging Servers (the SPI) like hornetq, openMQ or activeMQ.
Just looking at a JMS application we cannot know which underlying protocol is used. The same approach as JDBC.
WebSockets are the exact opposite: the network protocol is standardized. Also WebSockets are exclusively covering Publish-Subscribe (however: point-to-point can be also implemented on top of pub-sub).
Java EE 7 introduced a standard set of WebSocket APIs: JSR 356: JavaTM API for WebSocket. Now a Java WebSocket peer can easily communicate with a peer written in a different language.
Nothing prevent us to implement a JMS-over-WebSocket protocol. ...it is actually done already.See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices.
JMS is a MOM with has persistent queues and delivery guaranties. The overlap of use cases between JMS and WebSockets is very small.
Posted by javaservant on January 18, 2016 at 11:56 PM CET #