setCFCTimeout

Description

Sets the time-out, in seconds, during which the listener CFC must process the event request and return before ColdFusion gateway services terminates the request.

Category

Event Gateway Development

Syntax

void setCFTimeout(String timeout)

See also

getCFCTimeout, setCFCMethod, setCFCPath, CFEvent class in the Developing ColdFusion Applications

Parameters

Parameter

Description

timeout

The CFC time-out period, in seconds.

Usage

When ColdFusion calls a listener CFC method to process the event, and the CFC does not return in the specified time-out period, ColdFusion terminates the request and logs an error in the application.log file.

If you do not use this method, ColdFusion uses the Timeout Request value set on the Server Settings page in the ColdFusion Administrator.

Use this method if your messages require a longer or shorter time-out period than standard ColdFusion HTML requests.

Example

The following example code is based on the Socket gateway processInput method that takes input from the socket and sends it to the CFC listener methods. It sets the CFC time-out to 10 seconds.

for (int i = 0; i < listeners.length; i++) 
{ 
    String path = listeners[i]; 
    CFEvent event = new CFEvent(gatewayID); 
    Hashtable mydata = new Hashtable(); 
    mydata.put("MESSAGE", theInput); 
    event.setData(mydata); 
    event.setGatewayType("SocketGateway"); 
    event.setOriginatorID(theKey); 
    event.setCfcMethod(cfcEntryPoint); 
    event.setCfcTimeOut(10); 
    if (path != null) 
         event.setCfcPath(path); 
    boolean sent = gatewayService.addEvent(event); 
}