User Guide

Table Of Contents
204 Chapter 10: Building and Using ColdFusion Components
Using asynchronous CFCs
ColdFusion MX 7 provides an event gateway that lets you send a message to a CFC
asynchronously. This gateway lets you initialize processing by a CFC without waiting for the
CFC to complete or return a value. You can use asynchronous CFCs that use this gateway for the
following:
Reindexing a Verity collection
Logging information
Running batch processes
For more information on using asynchronous CFCs, see Chapter 42, “About event gateways,” on
page 1020.
Creating ColdFusion components
When you create CFCs, you create methods, which are ColdFusion user-defined functions, in the
component page. You pass data to a method by using parameters. The method then performs the
function and, if specified in the
cfreturn tag, returns data.
You can also define variables in a CFC. Within a CFC, these variables are known as properties.
Tags for creating CFCs
The following table lists the tags that you use to create a CFC. You use these tags on the CFML
page that defines the CFC.
Elements of a CFC
A CFC has the following characteristics:
It is a single CFML page with a .cfc filename extension. The component name is the same as
the filename. For example, if the file is myComponent.cfc, the component name is
myComponent.
The page is surrounded by a cfcomponent tag. No code can be outside this tag.
Tag Description
cfcomponent Contains a component definition; includes attributes for introspection. For
more information, see “Building ColdFusion components” on page 205.
cffunction Defines a component method (function); includes attributes for
introspection. For more information, see “Defining component methods”
on page 205.
cfargument Defines a parameter (argument) to a method; includes attributes for
introspection. For more information, see “Defining and using method
parameters” on page 209.
cfproperty Defines variables for CFCs that provide web services; also use to document
component properties. For more information, see “The cfproperty tag”
on page 215.