User Guide

Table Of Contents
1088 Chapter 45: Creating Custom Event Gateways
GatewayServices class
The Gateway class uses the coldfusion.eventgateway.GatewayServices class to interact with the
ColdFusion event gateway services. This class has the following methods:
CFEvent class
The Gateway class sends and receives CFEvent instances to communicate with the ColdFusion
listener CFC or application. The Gateway notifies ColdFusion of a message by sending a
CFEvent instance in a
GatewayServices.addEvent method. Similarly, the Gateway receives a
CFEvent instance when ColdFusion calls the gateways
outgoingMessage method.
The CFEvent class extends the java.util.Hashtable class and has the following methods to
construct the instance and set and get its fields. (In CFML, you treat CFEvent instances as
structures.)
Signature Description
GatewayServices getGatewayServices()
Static method that returns the GatewayServices object.
Gateway code can call this method at any time, if required.
boolean addEvent(CFEvent msg) Sends a CFEvent instance to ColdFusion for dispatching
to a listener CFC. The event gateway uses this method to
send all incoming messages to the application for
processing. Returns False if the event is not added to the
queue.
int getQueueSize()
Returns the current size of the ColdFusion event queue.
This queue handles all messages for all gateways.
int getMaxQueueSize()
Returns the maximum size of the ColdFusion event
queue, as set in the ColdFusion MX Administrator.
Logger getLogger()
Logger getLogger(String logfile)
Returns a ColdFusion Logger object that the event
gateway can use to log information in the
eventgateway.log log file (the default) or the specified log
file.
The logfile attribute must be a file name without a file
extension, such as mylogifile. ColdFusion MX puts the file
in the ColdFusion logs directory and appends .log to the
specified file name.
For information on using the logger object, see “Logging
events and using log files” on page 1099.
Methods Description
CFEvent(String gatewayID)
CFEvent constructor. The gatewayID parameter must be
the value that is passed in the gateway constructor or set
using the Gateway
setGatewayID method.
void setGatewayType(String type)
String getGatewayType()
Identifies the type of event gateway, such as SMS. For the
sake of consistency, use this name in the Type Name field
when you add an event gateway type on the Gateway
Types page in the ColdFusion MX Administrator.