Adam Bien's Weblog

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?

Answer:

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.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

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 #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License