setCFCPath

Description

Specifies the listener CFC that processes this event.

Category

Event Gateway Development

Syntax

void setCFCPath(String path)

See also

getCFCPath, setCFCMethod, setCFCTimeout, CFEvent class in the Developing ColdFusion Applications

Parameters

Parameter

Description

path

An absolute path to the application listener CFC that processes the event. If you do not call this method in your gateway, ColdFusion uses the first path configured for the event gateway instance on the Event Gateways page in the ColdFusion Administrator.

Usage

By default, ColdFusion delivers messages to the CFC in the first path configured for the event gateway instance on the Event Gateways page in the ColdFusion Administrator.

If your application supports multiple listener CFCs, use this method to set each listener CFC and then call the gatewayService.addEvent method to send the event to the CFC.

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. The listeners variable contains an array of listener CFCS and is set by the gateway’s setCFCListeners method, which ColdFusion calls when it starts the gateway.

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); 
}