Your ColdFusion application sends a message to a Flex application by doing the following actions:
In outgoing messages sent from CFML, the following structure members are translated to the Flex message:
Name |
Contents |
---|---|
body |
Body of the message. This is required. |
CorrelationID |
Correlation identifier of the message. |
Destination |
Flex destination of the message. This is required if it is not specified in the configuration file. |
Headers |
If the message contains any headers, the CFML structure that contains the header names as keys and values. |
LowercaseKeys |
If the value is set to yes, the structure keys are converted to lowercase during creation of ActionScript types. |
TimeToLive |
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:
Name |
Contents |
---|---|
MessageID |
A UUID that identifies the message. |
Timestamp |
Time the message is sent. |
ClientID |
ID of the Data Services Messaging event gateway instance. |
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 = "Email was sent at " & Now()> <cfset success.Destination = "gateway1"> <cfset ret = SendGatewayMessage("Flex2CF2", success)>
To ensure that properties maintain the correct case, you should define Flex-related information as follows:
myStruct['mySensitiveProp']['myOtherSensitiveProp']
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)>