Adobe COLDFUSION 9 Manual page 1336

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
private void processInput(String theInput, String theKey)
{
// Convert listeners list to a local array
// Protect ourselves if the list changes while we are running
String[] listeners;
int size = cfcListeners.size();
if (size > 0)
{
// Capture the listeners list
synchronized (cfcListeners)
{
listeners = new String[size];
cfcListeners.toArray(listeners);
}
}
else
{
// Create a dummy list
listeners = new String[1];
listeners[0] = null;
}
// Broadcast to all the CFC listeners
// Send one message at a time with different CFC address on them
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);
if (!sent)
log.error("SocketGateway(" + gatewayID + ") Unable to place message on
event queue. Message not sent from " + gatewayID + ", thread " + theKey
+ ".Message was " + theInput);
}
}
Responding to a ColdFusion function or listener CFC
The ColdFusion event gateway services call the
generated when the listener method of an event gateway application listener CFC returns a message or any CFML code
calls a
SendGatewayMessage
The
method parameter is a CFEvent instance, containing the information about the message to
outgoingMessage
send out. The CFEvent
getData
the message, including any message text. All CFEvent instances received by the outgoingMessage contain information
in the Data and GatewayID fields.
outgoingMessage
function. This method must send the message to the appropriate external resource.
method returns a Map object that contains event gateway-specific information about
Last updated 8/5/2010
method of the gateway to handle messages
1331

Advertisement

Table of Contents
loading

Table of Contents