Whatever message this page gives is out now! Go check it out!
<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> |
<cfset retValue.sourceAddress = arguments.CFEVENT.gatewayid> <cfset retValue.destAddress = arguments.CFEVENT.originatorid> <cfset retValue.ShortMessage = "Echo: " & arguments.CFEvent.Data.MESSAGE> |
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 SendGatewayMessage function 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 Data structure contents depend on the event 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. |
Identifier | Structure |
Session ID | gatewayType_gatewayID_originatorID |
cfid | originatorID |
cftoken | gatewayType_gatewayID |
To use Client scope variables with gateways, you must store the Client scope variables in a data source or the registry. You cannot store the variables in cookies, because gateways do not use cookies. |
sys = createObject("java", "java.lang.System"); sys.out.println("Debugging message goes here"); </cfscript> |
Celsius and Fahrenheit"> <cffunction name="onIncomingMessage" output="no"> <cfargument name="CFEvent" type="struct" required="yes"> <!--- Standard error message giving the correct input format. ---> <cfset var errormsg = "Please enter scale, integer where scale is F or C, for example:F, 32"> <!--- Get the message. ---> <cfset data=cfevent.DATA> <cfset message="#data.message#"> <!--- Where did it come from? ---> <cfset orig="#CFEvent.originatorID#"> <!--- Process the input, generate a message with the new temperature. ---> <!--- Input format is: degrees, temperature. ---> <cfif listlen(message) eq 2> <cfif (listgetat(message,1) IS "F") OR (listgetat(message,1) IS "Fahrenheit") OR (listgetat(message,1) IS "C") OR (listgetat(message,1) IS "Celsius")> <cfset scale=listgetat(message,1)> <cfif isNumeric(listgetat(message,2))> <cfset temperature=listgetat(message,2)> <cfswitch expression="#scale#"> <cfcase value="F, Fahrenheit"> <cfset retmsg = temperature & " degrees Fahrenheit is " & (temperature-32.0) * (5.0/9.0) & " degrees Celsius"> </cfcase> <cfcase value="C, Celsius"> <cfset retmsg = temperature & " degrees Celsius is " &(temperature * 10.0/5.0) + 32 & " degrees Fahrenheit"> </cfcase> </cfswitch> <cfelse> <cfset retmsg=errormsg> </cfif> <cfelse> <cfset retmsg=errormsg> </cfif> <cfelse> <cfset retmsg=errormsg> </cfif> <!--- Fill the return value as required for the event gateway type. ---> <cfif arguments.CFEVENT.GatewayType is "Socket"> <cfset retValue = structNew()> <cfset retValue.MESSAGE = retmsg> <cfset retValue.originatorID = orig> <cfelseif (arguments.CFEVENT.GatewayType is "Sametime") OR (arguments.CFEVENT.GatewayType is "XMPP")> <cfset retValue = structNew()> <cfset retValue.MESSAGE = retmsg> <cfset retValue.BuddyID = arguments.CFEVENT.DATA.SENDER> <cfset retValue.originatorID = orig> <cfelseif arguments.CFEVENT.GatewayType is "SMS"> <cfset retValue = structNew()> <cfset retValue.command = "submit"> <cfset retValue.sourceAddress = arguments.CFEVENT.gatewayid> <cfset retValue.destAddress = arguments.CFEVENT.originatorid> <cfset retValue.shortMessage = retmsg> </cfif> <!--- Send the return message back. ---> <cfreturn retValue> </cffunction> </cfcomponent> |
SendGatewayMessage(gatewayID, messageStruct) |
status = "No"; props = structNew(); props.Message = "Replace me with a variable with data to log"; status = SendGatewayMessage("Asynch Logger", props); if (status IS "OK") WriteOutput("Event Message ""#props.Message#"" has been sent."); </cfscript> |
myHelper = GetGatewayHelper(myGatewayID); status = myHelper.addBuddy("jsmith23", "Jim Smith", "support"); </cfscript> |
gatewayType (gatewayID) message body |