New BlazeDS with CF examples

May 15, 2009

Just posted up my examples I showed at my cfObjective presentation on BlazeDS.  It took some time because the README.txt file goes over  everything you need to run the examples and to get started. Included with the zip is the stock feeder, error logger, file explorer, and the file explorer as a AJAX/Blaze app. Thanks for those who attended. Hope this shows some interesting and different uses of BlazeDS.

The code and examples can be found at..

http://labs.fusionlink.com/katapult/index.cfm?page=articles/blazeds

Comments

Don Kerr

Don Kerr wrote on 10/18/099:03 PM

John, outstanding article. Very well written. I tried to configure BlazeDS on my CF8 server on my Mac to try it out. I'm having a tough time getting beyond this error when testing the send:

Unable to access the Flex Message Broker.

You may be trying to talk to Data Services when they are not installed as part of ColdFusion, or Data Services may not be configured correctly.

The error occurred in /Applications/ColdFusion8/wwwroot/messaging-example/cfstuff/send.cfm: line 24
22 :
23 : <!---Now sending the message to the CF event gateway which in turns sends it to BlazeDS--->
24 : <cfset SendGatewayMessage("errorsgateway", message)/>

I believe I've followed the BlazeDS CF8 install instructions correctly. Any ideas why I might be getting this error?

Thanks,
Don Kerr
Manager, Space City Adobe User Group
Houston, TX
Don Kerr

Don Kerr wrote on 10/20/0912:07 AM

John, per my previous comment, I got it working now by upgrading to CF9! Since it comes baked with BlazeDS instead of LiveCycle, I didn't have to manually configure it. Nice.

Thanks for your great examples. Really helped me understand the big picture in your article. Nice job.

Don Kerr
John Mason

John Mason wrote on 10/22/094:19 PM

They should work for either. Not sure what you ran into, but glad the upgrade solved it for you.
Don Kerr

Don Kerr wrote on 11/11/0912:56 PM

Hey John, using the cfm page as producer works great, but I can't get it to work with Flex as the producer using this code.

private function send():void{
var message:IMessage = new AsyncMessage();
message.body.DETAIL = "Detail of the message";
message.body.MESSAGE = "Error message name";
message.body.TYPE = "Information";
producer.send(message);
}

the flex consumer receives the cfm messages, but not from flex.

I'm not getting any errors. the message just doesn't appear when sent from flex.

Any ideas? Do you have a working example of flex as the producer I could look at to see what I'm missing?

Thanks,
Don
John Mason

John Mason wrote on 11/12/093:51 PM

Your variable type is wrong.

var message:IMessage = new AsyncMessage();

Should be..

var message:AsyncMessage = new AsyncMessage();
don Kerr

don Kerr wrote on 11/20/0911:20 PM

Figured it out after posting this last comment! It was something I didn’t find in any of the CF9 docs/blogs/etc. It was a problem with my gateway cfc . Had to add this function to the gateway cfc .

<cffunction access="public" name="onIncomingMessage" returntype="void">
   <cfargument name="body" type="Struct" required="true"/>
   <cfset message = StructNew()/>
<cfset message.body = body/>
<cfset message.Destination = "flexLongPolling"/>

<!---Now sending the message to the CF event gateway which in turns sends it to BlazeDS--->
<cfset SendGatewayMessage("flexgateway", message)/>
</cffunction>

So, in short, the same function that was working in my cfm page … needed to be included in the gateway cfc in order for the flex client to become the producer.
I also had to change the dot syntax
log.text += message.body.DATA.body.chatMessage + “\n”;
message was coming back inside .DATA.

Thanks for your article John ... it was very helpful as a I learned how to do BlazeDS with CF9!

Don

Write your comment



(it will not be displayed)