Adobe COLDFUSION 9 Manual page 1280

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
The listener CFC method must be named
response, it should return a structure containing a status field with a value of OK or EXCEPTION. (In this case, The
gateway checks the return status field, but does not process these return values further.) To send a message, the CFC
method must return a structure as documented in the following section.
Using the JMS Gateway as a producer
To send a JMS message, the return value of your CFC method or the second, messageStruct, parameter to the
function must be a structure with the following fields:
SendGatewayMessage
Field
Contents
status
Must be SEND.
topic
Name of the topic to publish the message to.
id
(Optional) The JMS correlation ID to associate with the message. The default is null.
message
Text of the message to publish.
asBytes
(Optional) How to publish the message:
If omitted, no, or false, send the message as text.
If any other value, send the message as byte-encoded UTF-8.
If you send the message in a
message, or EXCEPTION if it fails to send the message.
ActiveMQ JMS event gateway
Apache ActiveMQ is a message broker that implements JMS. The source for this event gateway is located in
gateway/src/examples/ActiveMQ. For information about using the ActiveMQ JMS event gateway, see the
gateway\docs\ActiveMQDeveloperGuide.pdf file.
Menu example application
ColdFusion is installed with a menu-based responder application. The menu application is written to work with any
of the standard ColdFusion event gateways (SMS, XMPP, and Sametime) and with the Socket example event gateway,
and ColdFusion is preconfigured with an instance of the application that uses SMS, as follows:
• The Gateway Instances page in the ColdFusion Administrator includes a gateway instance for this application that
uses the SMS gateway type.
• The gateway/cfc/examples/menu directory and its subdirectories include the CFML for the application
• The gateway/config/sms-test.cfg file is configured to use this application with the SMS client (phone simulator),
and short message service center (SMSC) server simulator that are provided with ColdFusion.
The application presents users with a drill-down menu of tools that they can use, including a weather report, stock
information, status and configuration information, and language tools such as a dictionary.
The code for this application is relatively complex and is distributed among 13 files. The following brief description
provides an overview of how it works. To get a full understanding of how the application works, see the source code.
• The top level, menu, directory contains two files: Application.cfm and main.cfc.
• The Application.cfm file consists of a single
application. Session variables maintain the current state information of the session, such as the active menu, and so on.
onIncomingMessage
function, the function returns OK if the gateway sends the
SendGatewayMessage
cfapplication
Last updated 8/5/2010
. If the CFC method does not send a message in
tag that enables session management and names the
1275

Advertisement

Table of Contents
loading

Table of Contents