User Guide

Table Of Contents
About event gateways 1023
Alternatively, a ColdFusion application can initiate a message by calling a ColdFusion function
that sends the message to the event gateway. The event gateway then forwards the message to an
external resource, such as an instant messaging server. A CFC in the application listens for any
responses to the sent message.
Some event gateways can be one-way: they listen for a specific event and send it to a CFC, or they
get messages from a ColdFusion function and dispatch it, but they do not do both. The example
DirectoryWatcherGateway listens for events only, and the asynchronous CFML event gateway
receives messages from CFML only. (You could even say that the directory watcher gateway
doesnt listen for events; it creates its own events internally by periodically checking the directory
state.)
Event gateway structure
Java programmers develop ColdFusion event gateways by writing Java classes that implement the
coldfusion.eventgateway.Gateway interface. ColdFusion event gateways normally consist of one
or more threads that listen for events from an event provider, such as a Socket, an SMSC server, or
some other source. The event gateway sends event messages to the ColdFusion event gateway
service message queue, and provides a method that gets called when an event gateway application
CFC or CFM page sends an outgoing message.
The event gateway class can also do the following:
Provide the ColdFusion application with access to a helper class that provides event gateway-
specific services, such as buddy-list management or connection management.
Use a file that specifies configuration information, such as IP addresses and ports, passwords,
and other ID information, internal time-out values, and so on.
About developing event gateway applications
ColdFusion application developers write applications that use event gateways. The person or
company that provides the event gateway supplies gateway-specific information to the
ColdFusion developer. This information must include the structure and contents of the messages
that the ColdFusion application receives and sends to the event gateway, plus any information
about configuration files or helper methods that the ColdFusion application might use.
The ColdFusion developer writes a CFC that listens for messages. Many event gateway types send
messages to a listener CFC method named
onIncomingMessage. A minimal event gateway
application might implement only this single method. More complex event gateway types can
require multiple CFC listener methods. For example, the ColdFusion XMPP IM event gateway
sends user messages to the
onIncomingMessage CFC method, but sends requests to add buddies
to the
onAddBuddyRequest CFC method.
Depending on the event gateway and application types, the event gateway application might
include CFM pages or CFC methods to initiate outgoing messages. The application also might
use an event gateway-specific GatewayHelper object to do tasks such as getting buddy lists in IM
applications or getting a messaging servers status.