Measuring message processing performance

November 25, 2008

Firstly, LiveCycle Data Services 2.6 Developer Guide is amazing. Everything is explained clearly. LCDS team rocks ๐Ÿ™‚

LiveCycle Data Services developer guide:

I was going through the document and found a topic which explains how adding a few tags in the services-config.xml file will get lots and lots of metrics regarding processing time of a message. Information regarding message size, server processing time, and network travel time is available to the clients. You can also get information on the server logs. This works for all types of channels. That means you can also measure performance for a Remoting call also. This is available in both BlazeDS and LCDS ๐Ÿ™‚

You can find detailed explanation on this mechanism at this URL:

Few metrics I liked the most are message size, server adapter time, server processing time, server send time and total time. There are lot more, you can find a table explaining the metrics in the URL included above.

We will have a look at main steps required to enable gathering metrics with a Remoting sample.

On the server

First you need to tell your channel to send the metrics to the clients. For this you need to add 2 tags in services-config.xml under the channel tag as shown below. Here I am adding it for an AMF channel. I am using this channel for my Remoting Service destinations. In the code snippet below tags in bold are the ones to be added. You have to add the tags for the channel you want the metrics for.


<channel-definition id=”my-amf” class=”mx.messaging.channels.AMFChannel”>

<endpoint url=”http://{}:{server.port}/{context.root}/messagebroker/amf” class=”flex.messaging.endpoints.AMFEndpoint”/>









On the client

MessagePerformanceUtils class will help you to parse the metrics from the message returned from the server. All you need to do is to pass the message to the MessagePerformanceUtils class constructor in the result handler. Once this is done, you will use MessagePerformanceUtils instance to retrieve the metrics.

Please download sample from this URL:

In the function below which is the result handler in the sample code attached, you can see we are passing the message object returned by the server to the MessagePerformanceUtils class. prettyPrint() method of this class returns a formatted string of metrics. You can find more details on MessagePerformanceUtils class at this URL

private function handleServerResponse(event:ResultEvent):void{

remoteObject.removeEventListener(ResultEvent.RESULT, handleServerResponse);

remoteObject.removeEventListener(FaultEvent.FAULT, ย ย ย ย ย ย ย ย ย ย ย ย ย  handleServerFault);

//processing the result

var performanceDetails:MessagePerformanceUtils =

new MessagePerformanceUtils(event.message);

txtOutput.text = performanceDetails.prettyPrint();


Creating Remoting destination and Java class

Please find details on how to invoke Java methods from Flex using Remoting at this URL

All you need to do is to create a Remoting destination with TestingOnly as id and set the source to a Java class with method below.

public String echo(String echoString){return echoString;}

That’s all you need to do ๐Ÿ™‚ now you have all metrics required to measure message processing performance.

riathon – RIA Hackathon by Adobe India

November 20, 2008

Registrations are open !!

Registrations are open for Adobe riathon 08. This is an excellent opportunity to show case your talent and win huge prizes ๐Ÿ™‚ Adobe is giving away lots and lots of prizes, I always wanted an iPhone and home theater system ๐Ÿ™‚ with so many prizes, probability to get at least one is very high ๐Ÿ™‚

About the event

If you are a Flex/ Flash / AIR developer and think you can be the one behind the coolest of all RIAs, you cannot afford to miss this event!

All you need to do is to register at build the coolest app that you can imagine and send it to Adobe on or before 26th November 2008.

Find more details about the event at

Adobe Rocks ๐Ÿ™‚ ๐Ÿ™‚

Adobe AIR 1.5 is live

November 18, 2008

Adobe Integrated Runtime (AIR) new version AIR 1.5 is live on

AIR 1.5 brings following features

1. Flash Player 10 features including 3D effects, pixel bender, new drawing API, dynamic media streaming, dynamic sound API, and more

2. Updated WebKit HTML engine with greatly improved JavaScript performance

3. Encrypted local SQL database support

4. JavaScript debugging support

5. Support for five additional languages (Swedish, Dutch, Czech, Turkish, and Polish)

6. Updated DRM engine

Adobe Flash Platform it is

November 18, 2008

Adobe Flash Platform

Innovation that stands out, technology that fits in

Excellent branding … Great going Adobe !

Adobe AIR team Blog

November 5, 2008

Adobe AIR team Blog is live at

It is maintained by the development team and is dedicated to tips, news and announcements related to Adobe AIR.

FileReference in Flash Player 10

November 4, 2008

In previous versions of Flash Player, when a user selects a file from his machine for uploading, developers had to send the file to the server and get it back to access the data in the file selected. In Flash Player 10, developers can access the File data selected by the user without a round trip to the server. This is an amazing enhancement. Adobe Rocks !!!

You can allow users to select a file and do all manipulations on the client (Flash Player) and let your user save it back to his system instead of sending the file to the server and processing it on the server. ๐Ÿ™‚

One more change to the FileReference class in Flash Player 10. The FileReference object methods browse, download, and save and the FileReferenceList.browse method will succeed only when called from within an ActionScript function that is the result of a user-initiated action. Find more details at this URL

I created a very simple sample which shows the changes mentioned above.

First you will have to configure your Flex Builder to target to Flash Player 10 and also use the new player APIs. This is very simple. Please follow the steps in this URL

First lets see how we can load and modify the file on the client.

Loading and saving file

First invoke the FileReference.browse() function and let the user select the file. Once the file selected event is invoked you should invoke FileReference.load() function to load the file into memory. Once loaded, it’s all yours ๐Ÿ™‚ in the sample I am allowing user to select a file and then loading the same and displaying it in a TextArea.

Download the source code from here

Try sample at this URL

Few functions in the source file are explained below.

Loading the file

In the function below, calling FileReference.browse() will pop up a window for user to select a file.

private function browseFile():void{

fileRef = new FileReference();

fileRef.addEventListener(Event.SELECT, onFileSelected);


var textTypeFilter:FileFilter = new FileFilter(“Text Files (*.txt)”,”*.txt”);





Function below will be invoked when the user selects the file. You can see that we are invoking the load() function and are waiting for the load to complete.

private function onFileSelected(event:Event):void{

fileRef.addEventListener(ProgressEvent.PROGRESS, onProgress);

fileRef.addEventListener(Event.COMPLETE, onComplete);

//this is where we load the file into memory



In the onComplete handler function, you can access the data using the FileReference object’s data property as shown in the source file attached.

Saving the file

In the sample we are displaying the data in the file in a TextArea. You can modify the data and then click on the save button. The save button will invoke the function below.

public function saveFile():void{

saveFileRef = new FileReference();

saveFileRef.addEventListener(Event.SELECT, onSaveFileSelected);

//this will throw a window for user to select the location

//and file name to save. Second argument is the default name,;


That’s all you need to do ๐Ÿ™‚

Other change as mentioned above is that you can invoke the browse/upload and other methods as described in the URL above only on user generated events like button click. In the sample I tried invoking a function on creationComplete event to popup a file selection popup using the browse() function. You can see that the call fails as creationComplete is not a user invoked event.

The same function is invoked on click of a button and it works perfectly. Please check attached code.