An Oracle blog about Java Technology

JMS over WebSocket

David Delabassee
Software Evangelist
Any application server which conforms to the Java EE Full Profile needs to include a messaging provider which supports the JMS API. Open Message Queue (aka Open MQ), the world first JMS 2.0 compliant MOM (Message Oriented Middleware), is the JMS provider for GlassFish. As GlassFish, Open MQ is open source too. Currently, GlassFish 4.0 is using Open MQ 5.0. In GlassFish 4.0.1, we plan to move to Open MQ 5.0.1. The 5.0.1 release comes with a set of fixed issues (see here) but also introduces new features such as WebSocket and STOMP support. 

The JMS specification is a messaging API and as such, it doesn't define the protocol to use on the wire. It is up to the JMS implementer to decide how to handle this. Open MQ supports socket TCP connections, it also supports HTTP/S tunnelling to make JMS messages easily flows through firewalls (See Annex C of the Open Message Queue Administration Guide).

With Open MQ 5.0.1, it is now possible to use WebSocket as the communication protocol between a client and an Open MQ JMS broker. Under the hood, Open MQ uses Grizzly and Tyrus.

A Java client will continue to use the JMS API so this is transparent. The only thing you have to take care is to specify, in your connection factory, the WebSocket URL of the Open MQ JMS Broker (imqAddressList=mqws://<broker-host>:<broker-ws-port>/<ws-service-name>). 

In addition, Open MQ 5.0.1 introduces 2 additional types of WebSocket clients, i.e. 'non JMS' clients that can be used to exchange messages with applications that do use JMS : 

  • mqstomp : Any (WebSocket) client that support STOMP 1.2 protocol
  • mqjsonstomp : Any (WebSocket) client that can sends JSON formatted STOMP 1.2 protocol
Those new types of clients are particularly interesting as they open the space for new scenarios (e.g.. simple JavaScript clients). The only thing the client need to have, in order to exchange messages with JMS applications, is STOMP and WebSocket support.

To find out more about this, you can check the 'JMS and WebSocket for Lightweight and Efficient Messaging' session that was presented during last JavaOne. You can also download and try Open MQ 5.0.1 today.

Join the discussion

Comments ( 2 )
  • guest Wednesday, July 2, 2014

    Is mqstomp and mqjsonstomp considered a "standard"?

    If so, is there an open specification I can download for mqstomp and mqjsonstomp?

    Which other JMS providers do support mqstomp and mqjsonstomp?

    What JMS features are not supported when running over mqstomp or mqjsonstomp?

  • David Delabassee Monday, July 7, 2014

    As far as we know, there's no STOMP over JMS formal standard yet. You should see this initial support more as an exploration.

    'mqstomp' and 'mqjsonstomp' supports the same set of STOMP frame headers that are supported by GF/Open MQ STOMP bridge. These headers maps to corresponding JMS messaging concepts (see http://docs.oracle.com/cd/E18930_01/html/821-2438/gjdkc.html#gjmnu).

    There are other JMS providers that support STOMP, some are using the same STOMP header frame names (see http://docs.codehaus.org/display/STOMP/Stomp+JMS).

    If you have any feedback on this, we'd like to hear it (inc. your use case scenario)!


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.