Skip to main content

Quote Streamer for WebSphere Application Server

Overview

The Quote Streamer for WebSphere Application Server sample application uses the Web Pub Sub Enterprise Bridge for Ajax library to simulate stock quotes to a Dojo-enabled client application. The Web Pub Sub ESB bridge library links a Dojo enabled client to a WebSphere Application Server’s internal message broker for Web-based publication/subscription implementation. Simulated quotes are generated by a CommonJ timer that publishes messages to a Service Integration Bus topic space.

Communication is achieved through the Bayeux protocol. The Dojo Toolkit's Cometd client links incoming JavaScript Object Notation (JSON) messages to the Dojo event/topic system for processing. In the QuoteStreamer sample application, multiple Dojo widgets are specified in a market report summary article in HTML format. These Dojo widgets process incoming stock quote messages and visually indicate stock changes. These visual changes include: update to the current price of a stock, daily stock price change, and daily stock percent price change. When the price of a stock changes, the daily price change and daily percent price change turn green (increase) or red (decrease) before fading back to the normal background color.

Ajax technologies to notice while viewing the live demonstration of the quote streamer:

  • There is no refreshing of the page.
  • Fading is a Dojo effect.
  • Actual values are generated on the server. The Bayeux protocol long polling transport is used for the long lived connection. The server holds the connection open for a timeout period of 30 seconds or until an event is received. In the QuoteStreamer sample, the server generates quotes every 4 seconds. Events are received asynchronously from the server with low latency.