ColdFusion 9.0 Resources |
setCFCPathSee alsogetCFCPath, setCFCMethod, setCFCTimeout, CFEvent class in the Developing ColdFusion Applications Parameters
UsageBy 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. ExampleThe 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); } |