The Art of Software Development

Jim Boone’s thoughts on software development and other important matters

Archive for the 'Dashboard Prototype' Category

RIA Prototype Client Using BlazeDS Messaging and JMS - J2EE Server

In a previous posting I gave an overview of the dashboard prototype that I created to investigate BlazeDS messaging with Flex clients. This posting focuses specifically on the J2EE application server component. I encourage you to read the prototype overview section of my initial post if you have not done so already to glean an understanding of what this server component does in the prototype.

Server Architecture

The EJB3 server architecture is quite basic and consists of one interface, one enterprise Java Bean (EJB), and one plain old Java object (POJO) value object. ITimer is a local interface that is implemented by the stateless DataGeneratorBean EJB. The DataGeneratorBean takes advantage of EJB timer service in order to generate events at the frequency specified by the client. You can start and stop message generation by calling the startTimer() or stopTimer() methods of the DataGeneratorBean EJB (these are the methods called by the client to start and stop message generation). It should be noted that by default EJB timers are persistent. That is if the timer is running when you shut the application server down it will start up automatically when you start the application server and again.

The MetricsVO value object is used to encapsulate the metrics data. A corresponding MetricsVO object is defined within the Flex client and the [RemoteClass(alias='info.jimboone.MetricsVO')] meta tag is added to the Flex definition object to assist BlazeDS in translating the Java object to/from the ActionScript object . You can view all of the Java EJB source files here.

BlazeDS Configuration

Integration of the J2EE server with BlazeDS occurs in the web.xml file. All that is required here is the definition of the MessageBrokerServlet servlet and a listener that keeps track of the HTTP Flex sessions (HttpFlexSession). This is fairly straightforward and very well documented within the BlazeDS Developers Guide (you can also view the web.xml files in the turnkey applications examples). The complete web.xml file is shown below:

Read more

3 comments

RIA Prototype Client Using BlazeDS Messaging and JMS - Flex Client

In a previous posting I gave an overview of the dashboard client that I created to investigate BlazeDS messaging with Flex clients. This posting focuses specifically on the Flex client.

One of the purposes of an application dashboard is to provide the user a means of rapidly discerning the state of an application using data visualization. I couldn’t think of a better use of Flex and than visualizing data! I am partial to real-time strip chart plots since you can monitor the history of operational parameters over a period of time. I am also partial to bar type meter that show the current value of a parameter and maybe even a high water mark. I envisioned a final dashboard application with many such strip charts and bar meters. The first objective of the prototype was to scope out an efficient way of displaying data for one set of metrics.

Charting Components

I wanted to try out some of the stock Flex charting components since I had never had the opportunity to work with them before. The LineChart component looked like a perfect component to use to draw my data in real time. Unfortunately, the LineChart does not allow you to present data in the same way that say the Windows performance monitor does as shown below.

Windows Performance Strip Chart

You basically have the choice of moving the whole chart as the performance monitor does or moving the data plot as you can with the bar chart component. Once I got over my preconceived notions of how a strip chart should work I found the LineChart to be perfectly adequate. The following show the LineChart component in the dashboard demo.

Dashboard Strip Chart

Although the stock LineChart component appears adequate for my purposes, I’m still a bit tempted to try to construct a strip chart component. After checking out the Degrafa web site, it looks like degrafa may be a good tool set to use in constructing a moving strip chart. I suppose I can also make my LineChart appear a bit more polished through CSS. Unfortunately, making UIs look pretty has not been in my job description up until this point so I have a bit to learn.
Read more

No comments

RIA Prototype client using BlazeDS messaging and JMS - Overview

Objectives

In this multi-part post, I will present a prototype that I developed that examines the integration of BlazeDS with a Java 2 Enterprise Edition (J2EE) messaging back-end. I have split the posting into three sections the first being an overview, the second presenting the Flex client and the third dealing with J2EE integration using EJB3. I recognize that many of you use other back-end server technologies such as Cold Fusion, PHP, or Ruby so you can ignore the third posting if you want to although the server Flex configuration files may be the same.

My objectives for writing the prototype were the following:

  • Configure BlazeDS messaging between a J2EE JMS topic and Flex clients
  • Examine the difference between BlazeDS polling and long-polling messaging
  • Tweak the various BlazeDS configuration parameters and observe the effects on the J2EE application server
  • Demonstrate Flex remoting with EJB3
  • Gain experience working with the Flex charting components for real-time charting application
  • Ensure that the client components utilize memory efficiently

Prototype Overview

I chose to develop a dashboard application that basically plots the value of three performance parameters in real time. This prototype mimics the functionality of an AIR application that I will be writing to monitor a production J2EE web application. The prototype application consists of a line chart that plots the performance parameters in real time and a bar chart that shows the instantaneous value for each parameter. The parameter values are generated randomly by the backend server code which places a value object containing these values into a JMS topic that the BlazeDS message broker is listening to. These messages will be forwarded to the Flex client when it is connected to the topic. The following diagram illustrates the basic configuration of the prototype.

Prototype Overview

The Flex client is used to start and/or stop a standard EJB timer session bean which creates a metrics data value object and sends it to a JMS topic (with topics messages are delivered to all subscribers) every time the timer fires. The user can set the frequency that the timer fires from the client. The EJB timer is controlled from the client via remote method calls. An EJB3 adaptor written by Ryan Norris was used to interface the Flex message broker with the J2EE application server. This link will take you to Ryan’s EJB and Flex Integration component.

The JMSAdapter class that is shipped BlazeDS is used to connect the message broker to the JMS topic and forwards messages to all Flex client subscribers. This adapter is feature rich and allows you to set about any configuration setting that a JMS client would need to. I even successfully tested connecting to a secured topic with no problems!

The following is a screenshot of the Flex client. It is not pretty, but it is an effective tool for exploring Flex and BlazeDS messaging. Click here for a full size image.

Dashboard Thumbnail

References

I would also like share many of the excellent references that I have found while developing this prototype. Of course the BlazeDS Developers Guide is a must read but it can be a bit overwhelming if you just want to get a sense of the big picture. I found the article entitled Introduction to the Flex Message Service to be an excellent introduction into Flex messaging. It is perhaps my personal favorite. You might also want to check it out an article titled Getting started with BlazeDS which provides a gentle introduction into BlazeDS messaging. Finally, there is an article on the Flex Developers Journal website titled How to Create a Multi User Flex Application Using JMS. Be warned that your browser will be spammed with all sorts of advertisements, a pet peeve of mine, but I suppose the Flex Developers Journal needs to pay the bills somehow. Stay tuned for some code!

No comments