Skip to main content
July 21, 2010
Question

Using new BlazeDS streaming channels in CF 9.0.1

  • July 21, 2010
  • 1 reply
  • 2562 views

The New Features document for ColdFusion 9.0.1 lists support for two new streaming channels in the included BlazeDS:

my-streaming-amf               coldfusion.flash.messaging.CFStreamingAMFEndPoint
secure-streaming-amf          coldfusion.flash.messaging.SecureCFStreamingAMFEndPoint

I tried hacking together a stanza for the CFStreamingAMFEndpoint in my services-config.xml mirroring some of the existing CF channels and the streaming-amf channel config from the main BlazeDS distro, but I haven't hit upon a configuration that works. Does anyone have a working example of using this channel from ColdFusion?

Here's what I cobbled together:

        <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">
            <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/cfstreamingamf"
                class="coldfusion.flash.messaging.CFStreamingAMFEndPoint"/>
            <properties>
                <connect-timeout-seconds>5</connect-timeout-seconds>
                <coldfusion>
                    <!-- define the resolution rules and access level of the cfc being invoked -->
                    <access>
                        <!-- Use the ColdFusion mappings to find CFCs-->
                        <use-mappings>true</use-mappings>
                        <!-- allow "public and remote" or just "remote" methods to be invoked -->
                        <method-access-level>remote</method-access-level>
                    </access>

                    <!-- Whether the Value Object CFC has getters and setters. Set the value of use-accessors to true if there are getters and setters in the Value Object CFC. -->
                    <use-accessors>true</use-accessors>
                    <!--Set the value of use-structs to true if you don't require any translation of ActionScript to CFCs. The assembler can still return structures to Flex, even if the value is false. The default value is false.-->
                    <use-structs>false</use-structs>

                    <!--Set the value of serialize-arrays-to-arraycollection to true if you require ColdFusion arrays to be converted to ArrayCollection on the ActionScript side. The default value is false. A false value
                    will convert ColdFusion Array to ActionScript Array-->
                    <serialize-array-to-arraycollection>false
                    </serialize-array-to-arraycollection>

                    <property-case>
                        <!-- cfc property names -->
                        <force-cfc-lowercase>false</force-cfc-lowercase>
                        <!-- Query column names -->
                        <force-query-lowercase>false</force-query-lowercase>
                        <!-- struct keys -->
                        <force-struct-lowercase>false</force-struct-lowercase>
                    </property-case>
                </coldfusion>
            </properties>
        </channel-definition>

Trying to subscribe to this channel from Flex gives this error:

[Error: (mx.messaging.messages::ErrorMessage)#0
  body = (Object)#1
  clientId = (null)
  correlationId = "7558F569-F411-F8AF-637F-F6F07E0CA184"
  destination = ""
  extendedData = (null)
  faultCode = "Client.Error.MessageSend"
  faultDetail = "Channel.Connect.Failed error Connect attempt timed out."
  faultString = "Send failed"
  headers = (Object)#2
  messageId = "DE999ED0-2447-2C7E-46F4-F6F07E18352E"
  rootCause = (mx.messaging.events::ChannelFaultEvent)#3
    bubbles = false
    cancelable = false
    channel = (mx.messaging.channels::StreamingAMFChannel)#4
      authenticated = false
      channelSets = (Array)#5
      connected = false
      connectTimeout = 5
      enableSmallMessages = true
      endpoint = "http://localhost/flex2gateway/cfstreamingamf"
      failoverURIs = (Array)#6
      id = "my-streaming-amf"
      mpiEnabled = false
      netConnection = (flash.net::NetConnection)#7
        client = (mx.messaging.channels::StreamingAMFChannel)#4
        connected = false
        objectEncoding = 3
        proxyType = "none"
        uri = (null)
      piggybackingEnabled = false
      polling = false
      pollingEnabled = false
      pollingInterval = 3000
      protocol = "http"
      reconnecting = false
      recordMessageSizes = false
      recordMessageTimes = false
      requestTimeout = -1
      uri = "http://{server.name}:{server.port}/flex2gateway/cfstreamingamf"
      url = "http://{server.name}:{server.port}/flex2gateway/cfstreamingamf"
      useSmallMessages = false
    channelId = "my-streaming-amf"
    connected = false
    currentTarget = (mx.messaging.channels::StreamingAMFChannel)#4
    eventPhase = 2
    faultCode = "Channel.Connect.Failed"
    faultDetail = "Connect attempt timed out."
    faultString = "error"
    reconnecting = false
    rejected = false
    rootCause = (null)
    target = (mx.messaging.channels::StreamingAMFChannel)#4
    type = "channelFault"
  timestamp = 0
  timeToLive = 0]

This topic has been closed for replies.

1 reply

Adobe Employee
July 26, 2010

As stated in the BlazeDS developer guide

http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=lcconfig_3.html, Streaming channels can be affected by HTTP connectors, proxies or other components that buffer the response stream since streaming involves a constant open connection.

Your example could be failing because of any of the above factors. The configuration looks fine. I see no issues with that. It is suggested to always use a fall back channel with the streaming channel. Refer the dev guide link above.

July 26, 2010

Could it really be the ColdFusion server Apache connector? That's the only thing between my test Flash movie and the ColdFusion server. I'm running this entirely on a development system.

I'll try connecting directly to the CF built-in Web server to see if that makes a difference.