Wednesday, March 21, 2007

First Look at Apollo and Flex Data Services

By now you’ve all most likely heard of Adobe releasing the Apollo alpha. Teknision is proud to have developed the only featured application upon its launch; the Finetune Desktop Player. Check it out!

Since Apollo’s release is so recent it’s been really exciting trying to create new and innovative desktop applications built upon web development tools. What makes it interesting is combining features usually reserved to rich internet applications (RIA) with file manipulation and other desktop centric ideals. Also noteworthy is the ability to build desktop tools that can not only communicate with the internet, but display HTML within them is not out of reach for the average developer.

One of my first stabs at such a program is an inter-office communication tools which can sit neatly in the users task bar, and notify users that they have a meeting or display a message. Although this ambition is not totally reachable yet, because Apollo doesn’t have the task bar integration, it is never-the-less an intriguing prospect. So I set out to get Flex Data Services working within an Apollo application. I was fairly new at the whole server-side communication and set up since I had really only skimmed the surface of the Flash Media Server, but after some trial and error I got communication flowing.

Here are some things to keep in mind when you’re setting up your FDS.

The Flex Data Services needs to be running on whatever server you’re trying to use as a communication medium.

Before you start up FDS make sure that the configuration XML is properly set up. This XML is located WEB-INF\flex\ folder and is called services-config.xml. By default there will be multiple channels defined and these channels will look at the {server.name} to get the path to the channel. For Apollo this server name needs to be hard coded, because the SWF is no longer running from a browser and it will not pass the correct name. For my example I created a new RTMP channel named my-local-rtmp and edited my-local-rtmp the endpoint to uri="rtmp://192.168.1.13:2038".

In my Apollo application, to keep everything simple, I used the Consumer and Producer pair. This pair requires a destination property which is also defined in the FDS configuration setup XML. In this case I entered my new destination in WEB-INF\flex\ messaging-config.xml, by adding a couple of lines.

<destination id="ChatTopic">

<channels>

<channel ref="my-local-rtmp"/>

</channels>

</destination>


Note that the channel reference points to the new channel that I created in the services-config.xml.

With my FDS server set up and running it was just a matter of tapping into the services provided using the Consumer and Producer pair and we had lift off.

I have to admit that I am really impressed with Apollo and FDS so far, and look forward to making many more application intertwining both of them.

No comments: