본문 바로가기

개발

자바 메시지(메시징) 웹소켓 : JMS over WebSocket

자바 메시지(메시징) 웹소켓 : JMS over WebSocket

JMS over WebSocket

http://www.parleys.com/play/52509ef4e4b0c4f11ec57671/about

JMS 2.0 provides a simpler API for accessing your messaging infrastructure. When it is extended by the addition of WebSocket, users can choose from a variety of integration methods for robust, reliable asynchronous messaging between applications. This session shows how using WebSocket can simplify message exchange between your applications and explains how you can combine all elements of your system—JMS 2.0–based applications; your JSR 356, Java EE WebSocket, Web applications; your rich client applications developed in JavaFX; and your JavaScript browser client applications—to achieve reliable, decoupled, robust applications across your complete enterprise.

JMS and WebSocket for Lightweight and Efficient Messaging

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.