
1314
DEVELOPING
COLDFUSION 9 APPLICATIONS
Using External Resources
Las
t
upda
te
d 8/5/2010
In addition, the Data Services Messaging event gateway automatically provides values for the following Flex message
fields:
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:
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)>
Handling incoming messages
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:
The incoming message data structure also includes the values of messageID and timeToLive from the Flex message.
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.
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.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...