CFEvent

Description

CFEvent constructor.

Category

Event Gateway Development

Syntax

CFEvent(String gatewayID)

See also

getGatewayID, CFML CFEvent structure, CFEvent class in the Developing ColdFusion Applications

Parameters

Parameter

Description

gatewayID

The ID of the gateway. This parameter indicates the source of the message and must be the value that is passed in the Gateway constructor or set using the Gateway setGatewayID method. The SMS gateway ID must be 21 characters or fewer.

Usage

This method creates a container for an event gateway message that you send to ColdFusion gateway services in a gatewayServices.addEvent method for delivery to a CFC listener method.

Example

The following example, based on code for the ColdFusion asynchronous CFML gateway, sends a message to that the gateway has received to a CFC:

public String outgoingMessage(coldfusion.eventgateway.CFEvent cfmsg) 
{ 
    // Get the data 
    Map data = cfmsg.getData(); 
    boolean status = true; 
    if (data != null) 
    { 
        // create an event 
        CFEvent event = new coldfusion.eventgateway.CFEvent(gatewayID); 
        //set the event field values 
        event.setGatewayType("CFMLGateway"); 
        event.setOriginatorID("CFMLGateway"); 
        event.setData(data); 
        // send it to the event service 
        status = gatewayService.addEvent(event); 
    } 
        return new Boolean(status).ToString(); 
}