Adobe COLDFUSION 9 Manual page 1332

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
Providing Gateway class service and information routines
Several gateway methods perform event gateway configuration services and provide event gateway information. The
ColdFusion event gateway services call many of these methods to configure the event gateway by using information
stored by the ColdFusion Administrator, and to get access to resources and information that the event gateway services
and applications require. Some of these methods can also be useful in event gateway code. The following methods
provide these services and information:
setCFCListeners
setGatewayID
getHelper
getGatewayID
getStatus
ColdFusion calls the
setCFCListeners
Administrator when it starts a gateway. ColdFusion also calls the method in a running event gateway when the
configuration information changes, so the method must be written to handle such changes. The
method must save the listener information so that the gateway code that dispatches incoming messages to gateway
services can use the listener CFCs in
ColdFusion calls the
setGatewayID
value set by this method.
ColdFusion calls the
getHelper
The following code shows how the SocketGateway class defines these methods. To create a gateway, modify the
definition to return the correct class, or to return null if no gateway helper class exists. Most gateways can
getHelper
leave the other method definitions unchanged.
public void setCFCListeners(String[] listeners) {
this.listeners = listeners;
}
public GatewayHelper getHelper() {
// SocketHelper class implements the GatewayHelper interface.
return new SocketHelper();
}
public void setGatewayID(String id) {
gatewayID = id;
}
public String getGatewayID() {
return gatewayID;
}
public int getStatus() {
return status;
}
Starting, stopping, and restarting the event gateway
Because an event gateway uses at least one listener thread, it must have
the threads. These methods must also maintain the status variable that the Gateway class
and change its value among
The start method
The
method initializes the event gateway. It starts one or more listener threads that monitor the event source
start
and respond to any messages it receives from the source.
method with the CFC or CFCs that are specified in the ColdFusion
methods.
setCFCPath
method when it starts a gateway. The
method when an application calls the CFML
,
,
STARTING
RUNNING
STOPPING
Last updated 8/5/2010
getGatewayID
GetGatewayHelper
,
, and
start
stop
,
, and
, as appropriate.
STOPPED
FAILED
setCFCListeners
method must return the
function.
methods to control
restart
method checks,
getStatus
1327

Advertisement

Table of Contents
loading

Table of Contents