In a recent blog I talked about using BlazeDS with ColdFusion 9. I explained how the gateway appeared to differ from other gateways. The gateway cfc didn't have to have an onIncomingRequest function defined. As a matter of fact the gateway didn't even need to point to a cfc at all. It could point to a blank cfm file.

After that post I talked with Aaron West about my findings in detail. Since it was his example that I used for my based he was interested in what I found. I was also contacted by Stephen Moretti as he was interested in my findings a well. The difference was that Stephen basically said what I found was not accurate. He has a BlazeDS/ColdFusion9 setup running and if he removed the onIncomingRequest his setup would fail.

Stephen and I talked a lot about his setup. We talked about the differences between what I had and what he had. What we discovered was that he was using FDMS. FDMS is the Ajax client library for BlazeDS. It allows you to use JavaScript to communicate with BlazeDS. There is still a flash component but you don't need to know flash to use it.

After knowing how Stephen was using it I went off and built another sample. After some tweaking I was able to get it up and running. I ran a few tests to verify messages were being sent then received. I then removed the onIncomingRequest function from the gateway cfc. Upon doing so I received this message:

view plain print about
1Error [Thread-16] - Error invoking CFC for gateway FlexMessagingJS: The method onIncomingMessage was not found in component /Applications/MAMP/htdocs/BlazeTesting/FDMS/gateway.cfc.

I then created a new sample to test a theory. I combined the samples I had from Aaron and Stephen to a single example. I used the code from Aaron's sample to do the send to BlazeDS. I then used Stephen's code to create the consumer. So now I have a jquery front end submitting to ColdFusion that sends the message to BlazeDS that a FDMS consumer receives.

After creating this sample I removed the onIncomingMessage from the cfc and ran some tests. This time the messages made it though without error. So, what was the major difference? Quite simple, I removed the part from the FDMS client so that it didn't register as a producer. I used jquery to send the message to ColdFusion and then have ColdFusion pass the message to BlazeDS. Thus the producer became the ColdFusion server.

In conclusion it would appear that if the message to BlazeDS is being sent by the ColdFusion server the cfc assigned to the gateway is not ran. However, if the producer is a different client then the gateway code is ran.

Till next time...

--Dave