CFEvent class

The Gateway class sends and receives CFEvent instances to communicate with the ColdFusion listener CFC or application. The Gateway notifies ColdFusion of a message by sending a CFEvent instance in a GatewayServices.addEvent method. Similarly, the Gateway receives a CFEvent instance when ColdFusion calls the gateway's outgoingMessage method.

The CFEvent class extends the java.util.Hashtable class and has the following methods to construct the instance and set and get its fields. (In CFML, you treat CFEvent instances as structures.)

Methods Description
CFEvent(String gatewayID)

CFEvent constructor. The gatewayID parameter must be the value that is passed in the gateway constructor or set using the Gateway setGatewayID method.

void setGatewayType(String type)
String getGatewayType()

Identifies the type of event gateway, such as SMS. For the sake of consistency, use this name in the Type Name field when you add an event gateway type on the Gateway Types page in the ColdFusion MX Administrator.

void setData(Map data)
Map getData()

The event data; includes the message being passed to or from ColdFusion. The content of the field depends on the event gateway type. The Map keys must be strings.

Because ColdFusion is not case-sensitive, it converts the Map passed in the setData method to a case-insensitive Map. As a result, do not create entries in the data with names that differ only in case.

void setOriginatorID(String id)
String getOriginatorID()

Identifies the originator of an incoming message or the destination of an outgoing message. The value depends on the protocol or event gateway type.

void setCFCPath(String path)
String getCFCPath()

An absolute path to the application listener CFC that will process the event. By default, ColdFusion uses the first path configured for the event gateway instance on the Event Gateways page in the ColdFusion MX Administrator.

void setCFCMethod(String method)
String getCFCMethod()

The method in the listener CFC that ColdFusion calls to process this event. By default, ColdFusion invokes the onIncomingMessage method. For the sake of consistency, Macromedia recommends that any event gateway with a single listener not override this default. A gateway, such as the ColdFusion MX XMPP gateway, that uses different listener methods for different message types, uses this method to identify the destination method..

void setCFCTimeout(String seconds)
String getCFCTimeout()

The time-out, in seconds, for the listener CFC to process the event request. When ColdFusion calls the listener CFC to process the event, and the CFC does not process the event in the specified time-out period, ColdFusion terminates the request and logs an error in the application.log file. By default, ColdFusion uses the Timeout Request value set on the Server Settings page in the ColdFusion MX Administrator.

String getGatewayID()

The event gateway instance that processes the event. Returns the gateway ID that was set in the CFEvent constructor.


View comments in LiveDocs