User Guide

Table Of Contents
1020 Chapter 42: Using Event Gateways
About event gateways
ColdFusion event gateways are ColdFusion MX elements that let ColdFusion MX react to or
generate external events or messages in an asynchronous manner. Event gateways let a ColdFusion
application handle information that does not come through an HTTP request. For example, you
can use event gateways to handle instant messages, short messages from mobile devices, or
messages sent to a TCP/IP port.
The event gateway mechanism has the following major features:
ColdFusion MX event gateways do not require HTTP requests. ColdFusion developers can
write ColdFusion MX gateway applications without using any CFM pages (just CFCs).
ColdFusion CFCs can use event gateways to listen for and respond directly to external events.
Event gateways operate asynchronously. A gateway typically gets a message and dispatches it
for processing, without requiring or waiting for a response.
ColdFusion developers can create event gateways to handle any kind of event that a Java
application can receive.
ColdFusion MX includes several product-level event gateways, such as a gateway for the XMPP
(Extensible Messaging and Presence Protocol) instant messaging protocol. Macromedia also
provides the source for several example gateways, such as a generalized socket gateway, that you
can extend to handle your specific needs. You can also write your own gateways in Java to handle
other event or messaging technologies supported by the Java runtime or by third-party providers,
such as gateways for additional instant messaging protocols, gateways for specific ERP systems, or
other protocols, such as NNTP.
Using event gateways
Because event gateways provide a generalized asynchronous messaging mechanism, you can use
them with many kinds of event or messaging resources. For example, ColdFusion MX includes
gateways (either product quality, or lighter weight example gateways) for communicating between
ColdFusion applications and the following types of resources:
Mobile phones and other devices that support short messaging services (SMS)
XMPP or IBM Sametime Instant message clients
Java Sockets (which let your ColdFusion application communicate with TCP/IP-based devices
and programs, such as Telnet terminal clients).
Java Messaging Service (JMS) resources, such as storefront sales order handling systems.
Event gateways are not limited to sending or receiving information using communications
protocols. For example, ColdFusion MX includes an example event gateway that monitors
changes to a directory and invokes a CFC method whenever the directory changes.
ColdFusion MX also includes an event gateway that lets a CFML application “call” a CFC
asynchronously and continue processing without getting a response from the CFC.
Just as you can create event gateways that serve many different event or messaging based
technologies, you can write many kinds of applications that use them. Just a few examples of
possible gateway uses include the following.