When a Flex application sends a message to a ColdFusion application, the Data Services Messaging event gateway sends a CFEvent structure to the onIncomingMessage function of the configured CFC, with the following information mapped to the data of the event:
Name |
Contents |
---|---|
body |
Body of the message. |
ClientID |
ID of the client that sent the message. |
CorrelationID |
Correlation identifier of the message. |
Destination |
Flex destination of the message. |
Headers |
If the message contains any headers, the CFML structure that contains the header names as keys and values. |
Timestamp |
Timestamp of the message. |
The incoming message data structure also includes the values of messageID and timeToLive from the Flex message.
Incoming message handling example
The following example places data that is contained in the body of the message from the Flex application into a structure. It then uses the contents of the structure to generate an e-mail message.
<cfcomponent displayname="SendEmail" hint="Handles incoming message from Flex"> |
If the Flex application sends the message in the header instead of in the body, you create and populate the structure, as the following example shows:
<cfset messageheader = StructNew()> |
New methods introduced in ColdFusion 9.0.1
The following new methods have been introduced in ColdFusion Messaging Gateway CFCs:
- allowSend
- allowSubscribe}}Both the methods take {{subtopic as the parameter. These methods help you place control over subscribing and sending data to a particular subtopic.
Note: To call these methods on their gateway CFC, specify the gateway id under the messaging destination in messaging-config.xml (Web_INF/Flex). By default, the value is *. |