ColdFusion 9: Flex Improvements
With the release of the ColdFusion 9 beta I thought I'd share a few of the Flex integration improvements I've been checking out this week. First, ColdFusion 9 now uses Blaze DS to power Flex remoting and messaging. ColdFusion has had remoting support for several versions, but before CF 9 you had to install LCDS or BlazeDS to get Flex messaging. With the move to Blaze DS there is no longer an integrated LCDS Express installation option, so if you want RTMP or data services you will have to buy a separate LCDS license or install the free LiveCycle Data Services ES Single-CPU License version yourself. I know some people feel this is a loss but I'm pretty happy having messaging available out of the box, without the single CPU limitation.
Another big improvement is that ColdFusion now correctly serializes CFC relationships to AMF. Previously, recursive or repeated object references were not correctly serialized. For example, serializing the the following object graph via CF would result in the child object being null for the father object when received in Flex.
child = createObject("component","child);
family.mother= createObject("component","parent");
family.mother.child = child;
family.father = createObject("component","parent");
family.father.child = child;
return family;
This was a huge issue that made ColdFusion almost unusable for serious OO Flex work. I'm very glad to see this fixed.
Another small enhancement to Flex messaging support is that the CFEventGatewayAdapter now supports selectors for message filtering. So in addition to using subtopics, you can now filter the messages a flex consumer receives based on message header values. For more on message filtering be sure to check out the BlazeDS Developer Guide.
Flex remoting is also reported to be much faster in ColdFusion 9 due to optimizations in the AMF serializing/de-serializing process, although I haven't tested this.
With all the Flex improvements the big thing that is missing from ColdFusion's Flex integration is lazy loading of Hibernate objects. Given how much Adobe is hyping Hibernate ORM support I'm surprised this isn't in ColdFusion 9. It would certainly make a compelling argument for powering your Flex applications with ColdFusion. There are actually a couple of bugs/enhancements logged for this, #76073 and #77738, so if you plan to use the new ORM features with Flex I encourage you to comment or vote on these issues.
Finally, I also ran into one backwards compatibility issue. Previously, when working with the Data Services Messaging Event Gateway the keys to the CFEvent structure passed into the onIncomingMessage event handler were not case sensitive. It seems that in CF 9 the keys in the body of the event are now case sensitive while keys in the event headers are not. I've logged a bug for this, #79712, if you would care to comment or vote.
I'm sure there are a lot of other improvement to ColdFusion 9's Flex integration that I'm missing here so if you know of any, or have any bugs/enhancements you would like to mention, please share.



I voted for #79712 BTW
I compared a LCDS RTMP channel with a BlazeDS long polling channel for a messaging application I did recently and couldn't really tell the difference. We ended up going with BlazeDS and long polling because we didn't have a one CPU server to deploy on. (How does one even get a one CPU server these days?)
Anyway my gut feeling is this: if your messaging application demands RTMP you probably don't want to be running on a one CPU server. If however you were using the data management capabilities of LCDS, then you may want to investigate how to integrate LCDS with ColdFusion.
I'm somewhat disappointed about this but I'll investigate alternative methods and perhaps there is a solution there that will fill our needs.
I've been a ColdFusion developer for about 5 years, and can do a lot of cool stuff with jQuery and alike, but time has come for me to have to write my first Flex app, and I'm hoping you might have a few suggestions.
I'm doing research on if it's even possible for me to do what I need. I'm building an app to manage scores for sporting events, and some things like the leader boards, really need to be refreshing in real time. So as new scores come in, they should immediately be reflected on all leader boards, ideally with some animation or highlight that indicates a score just changed. Now the closest thing I've seen to what I need to do were all those CNN, Fox, CNBC apps during the last presidential elections, where as results were coming in the data was automatically pushed to all the connected clients. I don't even know how that works conceptually, is it the server somehow pushing the data to the Flex clients? Cause I don't want every Flex client to have to keep hitting the server every couple of seconds querying for changes like a web page would have to.
Do I even need to use Flex to do this? Can LiveCycle be used with just JavaScript/ColdFusion somehow to do this.
Any help, suggestions, examples are highly appreciated.
Thanks,
-Roman