User Guide

Table Of Contents
1038 Chapter 42: Using Event Gateways
Using the CFML event gateway for asynchronous CFCs
The ColdFusion MX CFML event gateway lets CFML code send a message to CFC methods
asynchronously. This event gateway lets you initiate processing by a CFC method without
waiting for it to complete or return a value. Possible uses for asynchronous CFCs that you access
using this event gateway include the following:
Reindexing a Verity collection with new information without delaying an application, for
example, when a user uploads a new file
Logging information, particularly if there is significant amount of data to log
Running batch processes that might take a substantial amount of time to complete
Because asynchronous CFCs run independently of a request, they do not provide feedback to the
user. You must save any results or error information to a file, data source, or other external
resource.
By default, ColdFusion delivers the message to a CFC method named onIncomingMessage. You
can specify any method name, however, in the
SendGatewayMessage method’s data parameter.
CFML event gateway data structure
The structure that you use in the CFML
SendGatewayMessage function can include two types of
fields:
The structure can include any number of fields with arbitrary contents for use in by the CFC.
Several optional fields can configure how the gateway delivers the information to the CFC.
The CFML gateway looks for the following optional fields, and, if they exist, uses them to
determine how it delivers the message. Do not use these field names for data that you send to
your CFC method.
Field Use
cfcpath Overrides the CFC path specified in the ColdFusion MX Administrator. This field
lets you use a single gateway configuration in the ColdFusion MX Administrator
multiple CFCs.
method Sets the name of the method to invoke in the CFC. The default method is
onIncomingMessage. This field lets you use a single gateway configuration in the
ColdFusion MXAdministrator for a CFC that has several methods.
originatorID Sets the originatorID field of the CFEvent object that ColdFusion MX delivers to the
CFC. The default value is CFMLGateway.
timeout Sets the time-out, in seconds, during which the listener CFC must process the
event request and return before ColdFusion gateway services terminates the
request. The default value is the Timeout Request value set on the Server Settings
page in the ColdFusion MX Administrator. Set this value if a request might validly
take longer to process than the default timeout; for example, if the request involves
a very long processing time.