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.
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.
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 yet. Be the first.
Leave a reply
