Your ColdFusion application sends a message to a Flex application by doing the following actions:

  1. The ColdFusion application sends an outgoing message, in a cfreturn tag in the listener method of the listener CFC, or by calling the ColdFusion SendGatewayMessage function.
  2. A method provided by the Data Services Messaging gateway gets called when you send an outgoing message.
    In outgoing messages sent from CFML, the following structure members are translated to the Flex message:




Body of the message. Required.


Correlation identifier of the message.


Flex destination of the message. Required if it is not specified in the configuration file.


If the message contains any headers, the CFML structure that contains the header names as keys and values.


If the value is set to yes, the structure keys are converted to lowercase during creation of ActionScript types.


Number of milliseconds during which this message is valid.

In addition, the Data Services Messaging event gateway automatically provides values for the following Flex message fields:




A UUID that identifies the message.


Time the message is sent.


ID of the Data Services Messaging event gateway instance.


Note: A single instance of the Data Services Messaging event gateway can send messages to any destination that is registered with the ColdFusion Event Gateway Adapter. However, if the destination is configured in the Data Services Messaging gateway configuration file, the destination in the message is ignored.

Sending outgoing message example

The following example from a CFM page creates a structure that contains the message. The destination is the destination ID specified in the flex-services.xml file for the instance of the Data Services Messaging event gateway to send the message to. The body is the body of the message. The sendGatewyMessage CFML function sends the message to the instance of the gateway.

<cfset success = StructNew()>
<cfset success.msg = "E-mail was sent at " & Now()>
<cfset success.Destination = "gateway1">
<cfset ret = SendGatewayMessage("Flex2CF2", success)>

To ensure that properties maintain the correct case, define Flex-related information as follows:


The following is an example of using headers to send to a specific subtopic of the destination:

<cfset var msg = structnew()>
<cfset msg.destiNation = 'ColdFusionGateway'>
<cfset msg.body = 'somebody'>
<cfset msg['headers']['DSSubtopic'] = 'somesubtopic'>
<cfset sendgatewaymessage('CF2FLEX2' , msg)>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy