Adobe COLDFUSION 9 Manual page 1268

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
• By calling the ColdFusion
The first method is useful to automatically respond to incoming messages. Some complex applications that respond
to incoming messages could use the
Some event gateway types also use a GatewayHelper object to send information to external resources. For example, the
ColdFusion XMPP and Lotus Sametime instant messaging event gateways provide a GatewayHelper object that can
manage buddy lists, and set configuration and status information on the instant messaging server. For more
information on the GatewayHelper object, see
on the instant messaging GatewayHelper object, see
The example code in
"Example event gateway
how event gateways can require different data in the return structure to send equivalent messages.
Developing event gateway listener CFCs
The listener CFC responds to event gateway messages. The listener CFC uses, at a minimum, the following basic
software elements:
• One or more listener methods
• CFEvent structures that contain the messages
Listener CFCs can use ColdFusion persistent scopes to store data that must be preserved over multiple CFC
invocations or shared with other CFML elements.
Listener methods
The ColdFusion event gateway service calls one or more listener methods in the CFC to process incoming messages.
The number of listener methods that you must write and their names depends on the event gateway. For example, the
ColdFusion SMS event gateway requires a single listener method, which is typically named
can change the SMS event gateway listener method name in the event gateway configuration file.) The ColdFusion
XMPP IM event gateway expects the listener CFC to have five methods:
,
onAddBuddyResponse
onBuddyStatus
the method name, ColdFusion calls the
Adobe recommends you to use the
The listener method does the following:
1
Takes a single parameter, a CFEvent structure.
Processes the contents of the instance as required by the application.
2
Optionally, returns an outgoing message to the event gateway in a
3
to the event gateway by calling the ColdFusion
The following code shows a listener CFC with an
Socket event gateway that sent it. It contains the minimum code required to process an incoming message and respond
to the sender using the socket gateway.
function
SendGatewayMessage
SendGatewayMessage
"Using the GatewayHelper
"Sample IM message handling
CFC" on page 1266 shows the use of a listener return value, and indicates
, and
onIMServerMessage
onIncomingMessage
method for any event gateway with a single listener method.
onIncomingMessage
SendGatewayMessage
onIncomingMessage
Last updated 8/5/2010
function either in place or in addition to the return value.
object" on page 1268. For more information
application" on page 1282.
onIncomingMessage
. By default, if the event gateway does not specify
method of the listener CFC. For the sake of consistency,
tag. It can also send a message back
cfreturn
function.
method that echoes a message back to the
. (You
onIncomingMessage
,
,
onAddBuddyRequest
1263

Advertisement

Table of Contents
loading

Table of Contents