JMS Gateway

Integrating messaging enterprise middleware with real-time front-end technology.

jWebSocket JMS Gateway

jWebSocket easily interacts with any JMS compliant message queue instance. The JMS-Plug-in is an out-of-the-box component of jWebSocket. Basically, the architecture of this plug-in was designed to treat JMS nodes in the same way like all other jWebSocket clients. Particularly this means:

  • all JMS clients can bidirectionally communicate with all jWebSocket clients,
  • all JMS clients can make use of all jWebSocket services,
  • all JMS clients are subject to the same security mechanisms like the jWebSocket clients, i.e. filters, transformation, validation etc. are applied in the same way like for all jWebSocket clients.

jWebSocket uses JMS and since jWebSocket is a framework it is designed to integrate all JMS compliant message brokers. In its version 1.0 jWebSocket comes with an implementation for Apache ActiveMQ. In future further enterprise messaging broker systems will be approved.

jWebSocket as Enterprise Middleware Component

JMS compliant message brokers play a central role in enterprise middleware architectures. From the JMS perspective jWebSocket can be associated as one partner component in this architecture. jWebSocket provides its services to the enterprise components via its JMS Gateway. jWebSocket comes with lots of interfaces to various devices like native Smartphone apps, Arduino hardware or Remote Control and Monitoring systems. All these are made available to JMS nodes by the jWebSocket JMS gateway.

Apache Active MQ

Per default jWebSocket comes with a JMS plug-in configured for Apache ActiveMQ.

With Apache Active MQ you not only obtain a JMS compliant message broker, you also get a gateway to STOMP as well as to AMQP  clients. So you easily can interact with applications for instance written in Ruby, Perl, Python or PHP or even written for .NET, together with jWebSocket a ready-to-use enterprise middleware solution.

Installing and Running Apache ActiveMQ

To install Apache ActiveMQ on your server please follow the following steps:

  • Download Apache Actice MQ here: http://activemq.apache.org/download.html
  • Unzip the package into a folder of your choice
  • Set the ACTIVEMQ_HOME environment variable to the installation folder of ActiveMQ
  • Comprehensive information hwo to run ActiveMQ on the various operating systems you will find here: http://activemq.apache.org/getting-started.html.
  • Under Linux and Mac OS X simply change to the ActiveMQ installation folder and type bin/activemq start/stop to start or stop the server. Under Windows you will find a activemq.bat file. For production servers it is alos described how to run ActiveMQ as a service or daemon.

jWebSocket-JMS Bridge

There are two topics used for the bridge between jWebSocket and the JMS message broker.

  • org.jwebsocket.jws2jms (qeues all messages from jWebSocket to the JMS subsystem)
  • org.jwebsocket.jms2jws (queue all messages from the JMS subsystem to jWebSocket)

Like standardized for all jWebSocket plug-ins, also jWebSocket JMS plug-in is configured by spring. All JMS topics and parameters are configurable in the spring configuration file %JWEBSOCKET_HOME%conf/JMSPlugIn/jmx.xml.

Advisory Topic/Queues

For each queue and topic Apache ActiveMQ creates Advisory Topics, these are topics which inform subscribers about consumer and producer activities, for instance when a new consumer connects to the bridge (technically, when a JMS client listens to the topic org.jwebsocket.jws2jms topic) or when a certain consumer disconnects (e.g. when a JMS client shuts down).

When the jWebSocket JMS plug-in starts it establishes a connection to the topic org.jwebsocket.jws2jms as publisher and to org.jwebsocket.jms2jws as subscriber. Furthermore it registers as subscriber at the advisory topic ActiveMQ.Advisory.Consumer.Topic.org.jwebsocket.jws2jms.

This advisory topic notifies jWebSocket about new JMS clients (consumers) which then are maintained in the list of JMSConnector instances in the JMSEngine component.

Since jWebSocket supports the multiple engine concept the JMSEngine including all its clients fulfill all security requirements of all other clients in the network infrastructure. Broadcasts initiated by the server or by one client are send to all clients (WebSocket client and JMS nodes).

Communication

The JMS Gateway of jWebSocket listens to events of the advisory topic. When a JMS client connects as a subscriber to the topic org.jwebsocket.jws2jms a notification is queued on the advisory topic ActiveMQ.Advisory.Consumer.Topic.org.jwebsocket.jws2jms. Internally jWebSocket maintains a JMSEngine with an instance of JMSConnector per registered JMS node. Since jWebSocket supports multiple engine it is ensured that all WebSocket clients can interact with all JMS clients. As soon as a JMS node terminates an ActiveMQ queue an according message into the advisory queue. jWebSocket removes the corresponding client from its JMSEngine and cleans up the memory for it.

jWebSocket sends a welcome message to each JMS node which registers at the JMS Gateway. The JMS node can use this message to start any communication process or workflow.

  • "ns": "org.jwebsocket.jms.bridge"
  • "type": "welcome"

Continue reading about JMS Gateway here.


Publications

Learn more about WebSockets in general, get background information and gain deeper insight!

Join jWebSocket

Wether developer, designer or translator – join the jWebSocket team and grow together with our success!

Copyright © 2013 Innotrade GmbH. All rights reserved.