Adobe COLDFUSION 9 Manual page 1269

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
<cfcomponent displayname="echo" hint="echo messages from the event gateway">
<cffunction name="onIncomingMessage" output="no">
<cfargument name="CFEvent" type="struct" required="yes">
<!--- Create a return structure that contains the message. --->
<cfset retValue = structNew()>
<cfset retValue.DestinationID = arguments.CFEvent.OriginatorID>
<cfset retValue.MESSAGE = "Echo: " & arguments.CFEvent.Data.MESSAGE>
<!--- Send the return message back. --->
<cfreturn retValue>
</cffunction>
</cfcomponent>
Other event gateways require different fields in the return structure. For example, to echo a message using the SMS
event gateway, you use the following lines to specify the return value:
<cfset retValue.command = "submit">
<cfset retValue.sourceAddress = arguments.CFEVENT.gatewayid>
<cfset retValue.destAddress = arguments.CFEVENT.originatorid>
<cfset retValue.ShortMessage = "Echo: " & arguments.CFEvent.Data.MESSAGE>
The CFEvent structure
The ColdFusion event gateway service passes a CFEvent structure with information about the message event to the
listener method. The following table describes the structure fields:
Field
Description
GatewayID
The event gateway that sent the event; the value is the ID of an event gateway instance configured on the
ColdFusion Administrator Gateway Instances page. If the application calls the
to respond to the event gateway, it uses this ID as the function's first parameter.
Data
A structure containing the event data, including the message. The
gateway type.
OriginatorID
The originator of the message. The value depends on the protocol or event gateway type. Many event gateways
require this value in response messages to identify the destination of the response. Identifies the sender of the
message.
GatewayType
The type of event gateway, such as SMS. An application that can process messages from multiple event gateway
types can use this field. This value is the gateway type name that the event Gateway class specifies. It is not
necessarily the same as the gateway type name in the ColdFusion Administrator.
CFCPath
The location of the listener CFC. The listener CFC does not require this field.
CFCMethod
The listener method that ColdFusion invokes to process the event. The listener CFC does not require this field.
CFCTimeout
The time-out, in seconds, for the listener CFC to process the event request. The listener CFC does not require this
field.
When a ColdFusion application responds to an event gateway message, or sends a message independently, it does not
use a CFEvent structure. However, the ColdFusion event gateway service creates a Java CFEvent instance with the
message data before calling the
Using persistent scopes in listener CFCs
ColdFusion listener CFCs can use the Application, Client, and Session persistent scopes.
Because incoming event gateway messages are not associated with HTTP requests, ColdFusion uses different session
and client IDs for interactions initiated by these events than for CFM Page requests, as follows:
method of the event gateway.
outgoingMessage
Last updated 8/5/2010
SendGatewayMessage
structure contents depend on the event
Data
1264
function

Advertisement

Table of Contents
loading

Table of Contents