User Guide

Table Of Contents
1086 Chapter 45: Creating Custom Event Gateways
Sending messages The ColdFusion event gateway service calls the event gateway’s
outgoingMessage method and passes it a CFEvent instance with the destination and message
information. The event gateway forwards the message as appropriate to the external receiver.
The event gateway architecture is not limited to handling messages from external sources, such as
SMS devices or IM clients. It can also be used to handle events that are internal to the local
system or even the ColdFusion application. Also, a gateway does not have to implement two-way
communications.
The sample directory watcher gateway provided with ColdFusion MX is an example of an
internal, one way, gateway. It has a single thread that periodically checks a local directory and
sends a message to a CFC when the directory contents change. This gateway does not support
outgoing messages. (The code for this gateway is in the gateway/src/examples/watcher directory.)
Another internal gateway, the asynchronous CFML gateway, is provided as part of the
ColdFusion product. Unlike most gateways, it does not have a listener thread. Its
outgoingMessage method gets messages from CFML SendGatewayMessage functions, and
dispatches them to a CFC
onIncomingMessage method for handling. This gateway lets
ColdFusion support request-free asynchronous processing. For more information on using this
gateway, see “Using the CFML event gateway for asynchronous CFCs” on page 1038.
Event gateway elements
The following sections describe the elements that you use to create and configure a gateway:
Gateway interface
GatewayServices class
CFEvent class
GatewayHelper class
Gateway configuration file
Gateway development classes
Note: The gateway interfaces and classes, with the exception of the GenericGateway class are fully
documented in the “Gateway development interfaces and classes” section in CFML Reference. All
interfaces and classes in this list, including the GenericGateway class, are documented in less detail in
the Javadocs located in the ColdFusion MX gateways\docs directory. The Javadocs documentation
lacks examples and does not have the detailed usage information that you find in CFML Reference.