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.

family = createObject("component","family");
child = createObject("component","child);
family.mother= createObject("
family.mother.child = child;
family.father = createObject("
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.

Paul Kukiel's Gravatar I really havn't looked at the BlazeDS implementation in CF9 or the docs yet but are you saying I can still "push" data with CF9 as long as I install the single CPU LCDS Express package that came with CF8 ( I assume its available in CF9 ). If not that would be a shame as I use the eventgateways and flexmessaging to push data on our CF8 standard machines and I would hate to loose this when we upgrade to CF9.

I voted for #79712 BTW
# Posted By Paul Kukiel | 7/16/09 12:09 PM
Nathan Mische's Gravatar @Paul - Unless you enabled the RTMP channel, you should see no difference in flex messaging between ColdFusion 8 and ColdFusion 9. (The default destination for both versions, "ColdFusionGateway", use an AMF polling channel with similar configurations.)
# Posted By Nathan Mische | 7/16/09 4:54 PM
Paul Kukiel's Gravatar I have enabled the RTMP channels. I use RTMP and have polling as the fall back. I'm starting to feel like I'm goign to loose the ability to push over RTMP with CF9 ( standard ) I hope this is not the case.
# Posted By Paul Kukiel | 7/16/09 5:00 PM
Nathan Mische's Gravatar @Paul - As far as I know the integrated LCDS installation option is going away in CF 9. You can do real time server push with the HTTP streaming channels available in BlazeDS, or very near real time push with long polling channels.

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.
# Posted By Nathan Mische | 7/16/09 8:46 PM
Paul Kukiel's Gravatar I guess I'm going to have to look at long polling. The app that's using RTMP is a small internal app and it's been excellent for our uses. I feel its a little unfair that this will now be broken on CF9. We don't have the capacity to support ( pay for ) full LCDS at this stage so that's out of the question.

I'm somewhat disappointed about this but I'll investigate alternative methods and perhaps there is a solution there that will fill our needs.
# Posted By Paul Kukiel | 7/17/09 1:54 PM
Nathan Mische's Gravatar To be fair, it won't be broken in CF 9, it will just use an amf polling channel. You can choose to "upgrade" to a long polling or HTTP streaming channel, which CF will have out of the box. For messaging applications I really don't think this change will be a big deal. (Try the long polling or HTTP streaming channels, I think you will be surprised.)
# Posted By Nathan Mische | 7/17/09 2:41 PM
Paul Kukiel's Gravatar Thanks. I appreciate your time. There is so much documentation and so little time and without this post I wouldn't have know about it I will look into your alternatives and I may be back with questions :)
# Posted By Paul Kukiel | 7/17/09 2:53 PM
Roman's Gravatar I hope you can point me in the right direction...

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.
# Posted By Roman | 10/14/09 4:12 PM
Simon Lenoir's Gravatar Hi Nathan,

It seems that the bugs you mention:
Has been closed by Adobe without any response/workaround... Do you have any update to give on that ?

In my point of view those bug still apply in the current version.

This one, regarding CF9 Lazy loading is still open... but no news from adobe ! It's an important Hibernate features and make the use of relations almost impossible to use:

# Posted By Simon Lenoir | 3/18/10 12:08 AM
Nathan Mische's Gravatar Unfortunately I don't have any updates on those bugs but I will point out that they may be closed because they are fixed for the next release. Of course the flip side is they may be closed because Adobe doesn't plan to fix them. One of the big complaints about the "new" CF bug tracker is that is very difficult to track the status of bugs. There are many bugs marked as closed with absolutely no explanation.

As for Hibernate features, I hope they will be able to do more here but I have a feeling that there may be some conflict with LCDS, which does support Hibernate.
# Posted By Nathan Mische | 3/18/10 8:38 AM
Simon's Gravatar Hi Nathan,

Thanks for you replies.

I, like many other CF developer don't want to go to LCDS for many reasons. So I hope Adobe are going to improve Hibernate on Coldfusion and not try to push the use of other, more complex solutions.

Maybe you could help me on this problem:
I still have an issue when trying to send an object back to CF - HB ORM. This error message occur when I use entitysave:

"[RPC Fault faultString="Error deserializing client message." faultCode="Client.Packet.Encoding" faultDetail="null"]"

The error doesn't occur (and my user object get persisted in the database) if I delete his many-to-one realtion:
<cfproperty name="group" fieldtype="many-to-one" cfc="group" fkcolumn="group_id" fetch="join" remotingfetch="true" >

But of course I want to keep it !

I don't think it's related to a Coldfusion 9 Hotfix...

So I just don't have any other ideas of what's going on !

Thanks again for your help.

# Posted By Simon | 3/18/10 8:41 PM
Brendan Meutzner's Gravatar The fact that Adobe has "taken away" the built in LCDS ES version with CF9 is a huge blow to our operation. Our entire backend has been written against LCDS using the RTMP protocol in ColdFusion. Simply buying an LCDS license now isn't really a feasible option when licensing starts at 30k. The single CPU free version was perfect for our business model.

I did speak to Adobe sales re: my frustration with this, and he indicated he's heard similar feedback. Here's to hoping that Adobe will consider coming up with a DataServices only license for LCDS which is more cost effective.

I'm still researching the viability of switching at this point to BlazeDS, and wonder if you can shed some light on how the CF setup works differently with BlazeDS vs LCDS. I understand that we'll loose RTMP, but polling will probably be fine. My big concern is the effort involved in re-writing hundreds of CFC gateway and DAO files to accomplish this.

Have you ported any existing projects from LCDS to BlazeDS on the CF side?

Thanks for the great post re: this (it's so difficult to find quality information on LCDS and CF).

# Posted By Brendan Meutzner | 4/22/10 3:00 PM
Nathan Mische's Gravatar @Brendan - You shouldn't have to touch your CF code if you switch from an RTMP channel to a polling AMF channel.
# Posted By Nathan Mische | 4/22/10 4:22 PM
Brendan Meutzner's Gravatar Nathan,

I understand a simple switch of protocols within LCDS doesn't change anything, but from what I can tell, the messenger/consumer setup of BlazeDS is completely different the use of DataService class with LCDS, which uses DAO, Assembler, and VO files for the CRUD operations.

Have you migrated a ColdFusion project from LCDS to BlazeDS without any changes?
# Posted By Brendan Meutzner | 6/17/10 9:45 PM
Nathan Mische's Gravatar @Brendan - I think I understand your question now. If you are using the LCDS data management features, those are not available in BlazeDS. In that case you would need to manually install LCDS into CF 9. Instructions for installing LCDS 2.6.1 can be found here: Note, I can't find the EULA in the download so I'm not sure what the licensing restrictions are in terms of server CPU and application usage, but I'd have to assume it is still one CPU, one application.
# Posted By Nathan Mische | 6/18/10 8:42 AM
Nathan Mische's Gravatar So, it seems the only includes the bits to connect LCDS 2.6.1 to CF, not the actual LCDS 2.6.1 installation. I'm going to see if I can find out what the expected upgrade path is for CF 8/LCDS Express users.
# Posted By Nathan Mische | 6/18/10 9:03 AM
SImon's Gravatar Do we have any update on lazy loading fix for Coldfusion bind to Flex? or is it still not working and all graph is loaded?
# Posted By SImon | 8/2/10 7:51 PM
Nathan Mische's Gravatar @Simon - See the remotingFetch attribute of cfproperty:
# Posted By Nathan Mische | 8/3/10 8:33 AM
Simon's Gravatar Thanks Nathan, I checked that a while ago... doesn't work with Flex... all the object tree is load, there is no lazy loading.

I'm just gonna ask my boss $100 000 for LiveCycle, just to see he's reaction ;-0
# Posted By Simon | 8/3/10 8:51 AM
Mary Jo's Gravatar According to the Jira bug tracker, Adobe has no plans to fix the lazy loading issue with Flex, their reply being that you need to use LCDS. Great, thanks for the support Adobe.
# Posted By Mary Jo | 8/20/10 12:55 PM
Jeff Battershall's Gravatar Nathan, We've just upgraded to CF 9.01 and suddenly Data Services Messaging doesn't work - returns "Event Handler Exception" when you attempt to subscribe. Have you seen anything like this and do you have any suggestions?
# Posted By Jeff Battershall | 9/2/10 7:56 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.