The Web messaging service is a
publish and subscribe implementation that connects the browser to
the WebSphere® Application Server service integration bus for server-side
event push. Client/server communication is achieved through the Bayeux
protocol. The Bayeux protocol is an HTTP based messaging routing
protocol. For more information, see the
Bayeux
and cometd Web site. Client support for the Bayeux protocol is
provided by the Dojo Toolkit. Currently, the Dojo Toolkit is the
only JavaScriptTM library to support the Bayeux protocol.
Although any JavaScriptTM library or HTTP client
that implements the Bayeux protocol support can communicate with the
Web messaging service. The Web message service implementation bridges
incoming Bayeux requests to the service integration bus allowing
Web services, JMS clients, or any item connected to the service integration
bus to publish events to Web-based clients. You can use the Web
messaging service in a new or existing application by placing a
run time Java archive (JAR) file into WebSphere Application Server,
placing a utility file library JAR file in an application Web module,
setting up a simple configuration file, and configuring servlet mappings.
Figure 1: Overall
Architecture:
In a typical application, a browser periodically requests updates from a server at a specified interval or polling. The Bayeux protocol communication types differ from the traditional polling model and communication is through a long-lived HTTP connection in which a server typically holds a connection open for a certain time to wait for an event to push to the browser. With this style of communication, the Web container cannot scale as each waiting client consumes a thread waiting for an event. Other servers that handle this style of request have different methods for scaling. Because the Web messaging service is designed to work with existing versions of WebSphere Application Server, and the current Web container does not have the ability to scale well with this method of communication, a new mechanism is introduced in the Web messaging service to achieve scalability.
This new mechanism takes advantage of channel framework architecture and creates new channel framework channel that extends the HTTP channel to bridge incoming Bayeux requests to the service integration bus.
Current browser support for Web messaging service is made possible with the Dojo toolkit cometd client module. Initialization, subscription, unsubscription, and publishing operations are easy to accomplish with the cometd client. Through the cometd client, server-driven events are integrated into the Dojo event and topic system. Dojo cometd usage examples are provided in the Ajax developers guide and QuoteStreamer Sample application.
The Web messaging service connects browser clients to the built-in messaging engine and the service integration bus for subscribing and publishing to events and receiving messages. The underlying bridge to the service integration bus occurs through direct API calls to a service integration bus topic space. Multiple ways to publish messages to Web clients exsist, since the Web clients are connected to the service integration bus. Some of these options include: standard Enterprise JavaBeans (EJB) publishing to a topic, a JMS client publishing to a topic, a Web service, or the Web client itself publishing to other Web clients.