1. Trang chủ
  2. » Công Nghệ Thông Tin

ColdFusion Developer’s Guide phần 10 ppsx

123 680 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 123
Dung lượng 2,45 MB

Nội dung

106 Chapter 56: Using Event Gateways Adobe ColdFusion provides event gateways, which you can use when writing applications. You configure an event gateway for an application and deploy the application. To use event gateways, you should have a thorough knowledge of ColdFusion development concepts and practices, including ColdFusion components (CFCs). To write applications for custom gateways that are not provided in ColdFusion, you must also know the details of the event gateway you are using, including its requirements. Contents About event gateways . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1060 Event gateway facilities and tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1064 Structure of an event gateway application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1066 Configuring an event gateway instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067 Developing an event gateway application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1068 Deploying event gateways and applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075 Using the CFML event gateway for asynchronous CFCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075 Using the example event gateways and gateway applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077 About event gateways ColdFusion event gateways are ColdFusion elements that let ColdFusion 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 event gateways do not require HTTP requests. ColdFusion developers can write ColdFusion 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 includes several product-level event gateways, such as a gateway for the XMPP (Extensible Messaging and Presence Protocol) instant messaging protocol. Adobe 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. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 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 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 includes an example event gateway that monitors changes to a directory and invokes a CFC method whenever the directory changes. ColdFusion 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. Server to client push examples • An application that sends an instant message (IM) or SMS text message to a person who can approve a purchase order, get a response, and mark the purchase order as approved or denied. • A bot that notifies users through their preferred messaging method (cell phone, instant messaging, or even e- mail) when watch list stock goes up, and offers to buy or sell the stock immediately. • An application that authenticates web users by sending them an SMS message that includes code that they must to enter into the browser in order to proceed. Client to server examples • A menu-based SMS application that lets users get information from any of several web service data providers. ColdFusion includes a SMS menuing example int the gateways/cfc directory. • A instant messaging application that takes messages from users to technical support and assigns and directs the messages to the most available support staff member. The application could also log the user ID and session, and you could use ColdFusion to generate usage reports. • A directory lookup robot IM "buddy" that responds to messages chat contain an employee’s name with the employee’s phone number or buddy ID. Server to serve examples • A JMS subsystem that publishes status updates that are consumed by business intelligence systems. • A system that monitors and publishes download events from a website. Event gateway terms and concepts This document uses the following terms when referring to event gateways: Event: A trigger that ColdFusion can receive from an external source. ColdFusion event gateways receive events. Message: The information provided by an event. In ColdFusion, a message is the data structure that the event gateway receives when an event is triggered. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 Event gateway: Java code that receives events and sends them to and from ColdFusion application code. This document uses the term event gateway, without the word type or instance, to refer to the general concept of a ColdFusion event gateway. Where the context makes the meaning obvious, the term can also refer to event gateway type or event gateway instance. Event gateway type: A specific event gateway implementation, represented by a Java class. Each event gateway type handles messages belonging to a particular a communications method or protocol, such as short message service (SMS), an instant messaging protocol, or Sockets. You generally have one event gateway type per communication protocol. You configure each event gateway type on the Gateway Types page in the Event Gateways area in the ColdFusion Administrator. Event gateway instance: A specific instance of an event gateway type class. You configure each event gateway instance on the ColdFusion Gateways page by specifying the event gateway type, an ID, the path to the event gateway application CFC that uses this instance, and a configuration file (if needed for the selected event gateway type). You can have multiple event gateway instances per event gateway type, for example, for different event gateway applica- tions. Event gateway application: One or more CFCs and any supporting CFM pages that handle events from an event gateway instance and send messages using the event gateway instance. The event gateway application is not part of an event gateway instance, but the code that is responsible for processing event messages to and from the instance. Event gateway listener: Code in an event gateway that receives events from an event source and passes them to the ColdFusion gateway service for delivery to a CFML listener CFC. Listener CFC: A CFC that contains one or more methods that respond to incoming messages from one or more event gateway instances. Part of an event gateway application. ColdFusion gateway service: The part of ColdFusion that provides underlying support for event gateways, including a path between an event gateway instance and listener CFCs. How event gateway applications work The following diagram shows the architecture of ColdFusion event gateway applications: How event gateways interact Typically, a ColdFusion event gateway instance, a Java object, listens for events coming from an external provider. For example, a general socket event gateway listens for messages on an IP socket, and an SMS event gateway receives messages from an SMSC server. Event Gateway Instance SMSC server (for SMS messages) Instant messaging provider Other message generator/receiver Event Gateway Instance Event Gateway Instance ColdFusion Event Gateway Service Java Event Event Event Event Event Event CFEvent CFEvent CFEvent CFEvent CFEvent CFEvent ColdFusion Event Gateway Application Event Gateway Application CFML Listener CFC CFEvent Message Event Gateway Application Listener CFC CFEvent Message CFEvent Message Listener CFC CFM Page . . . . . . . . . ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 Each event gateway instance communicates with one or more listener CFCs through the ColdFusion event gateway service. The listener CFCs receive CFEvent object instances that contain the messages, process them, and can send responses back to the event gateway, which can send the messages to the external resources. Alternatively, a ColdFusion application can initiate a message by calling a ColdFusion function that sends the message to the event gateway. The event gateway then forwards the message to an external resource, such as an instant messaging server. A CFC in the application listens for any responses to the sent message. Some event gateways can be one-way: they listen for a specific event and send it to a CFC, or they get messages from a ColdFusion function and dispatch it, but they do not do both. The example DirectoryWatcherGateway listens for events only, and the asynchronous CFML event gateway receives messages from CFML only. (You could even say that the directory watcher gateway doesn’t listen for events; it creates its own events internally by periodically checking the directory state.) For information on the asynchronous CFML event gateway, see “Using the CFML event gateway for asynchronous CFCs” on page 1075. Event gateway structure Java programmers develop ColdFusion event gateways by writing Java classes that implement the coldfusion.event- gateway.Gateway interface. ColdFusion event gateways normally consist of one or more threads that listen for events from an event provider, such as a Socket, an SMSC server, or some other source. The event gateway sends event messages to the ColdFusion event gateway service message queue, and provides a method that gets called when an event gateway application CFC or CFM page sends an outgoing message. The event gateway class can also do the following: • Provide the ColdFusion application with access to a helper class that provides event gateway-specific services, such as buddy-list management or connection management. • Use a file that specifies configuration information, such as IP addresses and ports, passwords, and other ID infor- mation, internal time-out values, and so on. About developing event gateway applications ColdFusion application developers write applications that use event gateways. The person or company that provides the event gateway supplies gateway-specific information to the ColdFusion developer. This information must include the structure and contents of the messages that the ColdFusion application receives and sends to the event gateway, plus any information about configuration files or helper methods that the ColdFusion application might use. The ColdFusion developer writes a CFC that listens for messages. Many event gateway types send messages to a listener CFC method named onIncomingMessage. A minimal event gateway application might implement only this single method. More complex event gateway types can require multiple CFC listener methods. For example, the ColdFusion XMPP IM event gateway sends user messages to the onIncomingMessage CFC method, but sends requests to add buddies to the onAddBuddyRequest CFC method. Depending on the event gateway and application types, the event gateway application might include CFM pages or CFC methods to initiate outgoing messages. The application also might use an event gateway-specific Gateway- Helper object to do tasks such as getting buddy lists in IM applications or getting a messaging server’s status. The ColdFusion application developer also configures an event gateway instance in the ColdFusion Administrator, and possibly in a configuration file. The ColdFusion Administrator configuration information specifies the listener CFC that handles the messages from the event gateway and other standard event gateway configuration details. The configuration file, if required, contains event gateway type-specific configuration information. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 Event gateway facilities and tools ColdFusion provides a number of features and tools for developing and deploying event-handling applications, these including the following: • Standard event gateways. • Development tools and example code. • A gateway directory structure configured for use by custom event gateways and event gateway applications. This directory also contains the example code. • An event gateway-specific log file • Three pages in the ColdFusion Administrator for managing event gateways. Standard event gateways Adobe provides several event gateways as part of ColdFusion. These event gateways support the following messaging protocols: • SMS (Short Message Service): A system designed for exchanging short, often text, messages with wireless devices, such as mobile phones or pagers. For detailed information on using the SMS event gateway, see “Using the SMS Event Gateway” on page 1099. • XMPP (Extensible Messaging and Presence Protocol): An open, XML-based protocol for instant messaging. For detailed information on using the XMPP event gateway, see “Using the Instant Messaging Event Gateways” on page 1083. • IBM Lotus Instant Messaging: (commonly referred to as Lotus Sametime) The IBM product for real-time collaboration. For detailed information on using the Lotus Sametime event gateway, see “Using the Instant Messaging Event Gateways” on page 1083. ColdFusion also provides an event gateway, the CFML asynchronous event gateway, that lets a CFML application invoke a CFC method asynchronously. This event gateway does not follow the model of providing a mechanism for exchanging messages with resources outside of ColdFusion. Instead, it provides a one-way path for invoking CFCs when an application does not require (indeed, cannot receive) a return value from the CFC. For detailed information on using the CFML asynchronous event gateway, see “Using the CFML event gateway for asynchronous CFCs” on page 1075. Development tools and example code ColdFusion provides the following tools and example code for developing your own event gateways and event gateway applications: • An SMS client (phone simulator) and a short message service center (SMSC) server simulator, for developing SMS applications without requiring an external SMS provider. • Four sample event gateways with source code: • A template for an empty event gateway that contains a skeleton on which you can build your own event gateways • A TCP/IP socket event gateway that listens on a TCP/IP port • A directory watcher event gateway that monitors changes to the contents of a directory • A Java Messaging Service (JMS) gateway that acts as a JMS consumer or producer. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 • Several sample applications, including the following: • A menu application that uses an inquiry-response drill-down menu to provide services such as weather reports and stock quotes. • A simple echo application that sends back the messages that it receives. • A temperature converter, an asynchronous logging application. • An application that returns employee phone number and other information. The chapters in this manual use these example applications. • Javadoc documentation for the Java interfaces and classes that you use to create gateways. For more information on these examples, see “Using the example event gateways and gateway applications” on page 1077. The ColdFusion gateway directory The ColdFusion installation includes a cf_root\WEB-INF\cfusion\gateway directory on J2EE configurations, or cf_root\gateway directory on server configurations. This directory contains all the code for ColdFusion example event gateways and example event gateway applications, and example configuration files for use by standard ColdFusion event gateways. You do not have to put your event gateways, event gateway application CFCs, or event gateway configuration files in this directory, but ColdFusion is configured to find event gateways and CFCs that you put there. The following table lists the event gateway directory subdirectories, their purpose, and their initial contents. For more information on using the example event gateways and applications, see “Using the example event gateways and gateway applications” on page 1077. Directory Purpose cfc Event gateway application CFCs. ColdFusion is installed with an Administrator Mapping between /gateway and this cfc directory. cfc/examples Code for the ColdFusion sample applications. config Configuration files for all ColdFusion event gateways, including standard ColdFusion event gateways, such as SMS, and example event gateways, such as the directory watcher event gateway. doc/api Javadoc for the Gateway, and GatewayHelper interfaces, and the CFEvent, GatewayServices, and GenericGateway classes that gateway developer use when writing gateways. This documentation is a subset of the information in “Gateway development interfaces and classes” on page 1325 in the CFML Reference. lib Executable code for example and user-developed event gateway classes. The ColdFusion class loader includes this directory on its classpath and includes any JAR files that are in that directory on the class path. The examples.jar file in this directory contains the class files for the DirectoryWatcherGateway, EmptyGateway, and SocketGateway classes. src/examples Source code for the example event gateway classes that Adobe provides. Includes the EmptyGateway.java file and the following subdirectories: • socket: Socket gateway source files • watcher: directory watcher gateway source files • JMS: JMS gateway source files ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 The eventgateway.log file Event gateways provided with ColdFusion log event gateway errors and events to the cf_root\WEB- INF\cfusion\logs\eventgateway.log file on J2EE configurations, or the cf_root\logs\eventgateway.log file on server configurations. ColdFusion includes methods that let any event gateway use this file. This log file can be very useful in debugging event gateways and event gateway applications. ColdFusion Administrator event gateway pages The ColdFusion Administrator includes a Gateways section with three pages for managing event gateways: • Settings • Gateway types • Gateways The Settings page lets you enable and disable support for event gateways, specify the number of threads that ColdFusion can devote to processing events, specify the maximum number events that ColdFusion can hold in its event queue (which holds events that are waiting to be processed) and start the SMS test server. The Gateway Types page lets you add, remove, and configure event gateway types by specifying a name, a Java class, and startup time-out behavior. Note: The gateway type name in the ColdFusion Administrator does not have to be the same as the gateway type that is used in the gateway Java code and the CFEvent data structure; however, you should use the same name in both places for consistency. The Gateways page lets you add, remove, configure, start, and stop individual event gateway instances. You configure an event gateway instance by specifying a unique ID, the gateway type, one or more listener CFC paths, a configu- ration file (not required for all gateway types), and a startup mode (manual, automatic, or disabled). Structure of an event gateway application To develop an event gateway application, you create and use some or all of the following elements: • One or more listener CFCs that handle any incoming messages and send any necessary responses. • In some applications, ColdFusion pages that generate outgoing messages directly. • An event gateway instance configuration in the ColdFusion Administrator. This configuration might require a separate event gateway configuration file. • In some applications, a GatewayHelper object to provide access to additional features of the protocol or technology; for example, to manage instant messaging buddy lists. The role of the listener CFC All incoming event messages must be handled by one or more listener CFCs. You specify the listener CFCs when you configure an event gateway in the ColdFusion Administrator. You must specify at least one CFC in the administrator. Some gateway types can use more than one CFC. By default, the ColdFusion event gateway service delivers events by calling the CFC’s onIncomingMessage method. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 The event gateway developer must inform the event gateway application developer of methods that the listener CFC must implement (may be only the onIncomingMessage method) and of the structure and contents of the event message data, contained in the CFEvent instance, that the listener CFC must handle. Outgoing messages have the same event message data structure as incoming messages. Many gateways let the listener CFCs send a response by calling the cfreturn function, but ColdFusion does not require a return value. Listener CFCs can also use the SendGatewayMessage function, which provides more flexi- bility than the cfreturn tag. The role of ColdFusion pages ColdFusion CFM pages cannot receive event messages. However, they can send messages using an event gateway. Therefore, an event gateway application that initiates outgoing messages might use one or more SendGatewayMessage functions to send the messages. An application that sends an SMS message to notify users when a package ships, for example, could use the SendGatewayMessage function to send the notification. The role of the ColdFusion Administrator The Gateways page in the ColdFusion Administrator associates a specific event gateway instance with one or more listener CFCs that processes messages from the event gateway. It tells the ColdFusion event gateway service to send messages received by the event gateway to the listener CFC. It also lets you specify a configuration file for the event gateway instance and whether to start the event gateway instance (and therefore any responder application) when ColdFusion starts. For more information on using the Administrator, see the ColdFusion Administrator online Help. The role of the GatewayHelper object A ColdFusion event gateway provides an information conduit: at its most basic, it receives and dispatches event messages. In some cases, however, an event gateway must provide additional functionality. An instant messaging event gateway, for example, needs to provide such services as managing buddies and providing status information. To support such use, an event gateway can enable access to a GatewayHelper object. The event gateway developer writes a Java class that provides the necessary utility routines as Java methods, and ColdFusion application devel- opers can get an instance of the class by calling the CFML GetGatewayHelper method. The application calls the GatewayHelper object’s methods using normal ColdFusion object access techniques. The ColdFusion instant messaging event gateways and the example socket event gateway provide GatewayHelper objects. Configuring an event gateway instance Before you develop or deploy an event gateway application, you must use the ColdFusion Administrator to configure an event gateway instance that will handle the event messages. You specify the following information: • An event gateway ID to identify the specific event gateway instance. You use this value in the CFML GetGatewayHelper and SendGatewayMessage functions. • The event gateway type, which you select from the available event gateway types, such as SMS or Socket. • The absolute path to the listener CFC or CFCs that will handle incoming messages. If you have multiple listener CFCs, enter the paths separated by commas. You must specify absolute file paths, even if you put the CFCs in the ColdFusion gateway\cfc directory. • A configuration file, if required for this event gateway type or instance. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 • The event gateway start-up status; one of the following: Automatic: Start the event gateway when ColdFusion starts. Manual: Do not start the event gateway with ColdFusion, but allow starting it from the ColdFusion Adminis- trator Event Gateways list. Disabled: Do not allow the event gateway to start. Developing an event gateway application All event gateway applications handle information. They exchange event messages, and possibly other types of infor- mation, with other resources. Event gateway applications require a listener CFC to handle events that are sent to the event gateway. Event gateway applications can also use the following code elements: • SendGatewayMessage CFML functions to send messages from outside the listener CFC (or, optionally, from the CFC) • GatewayHelper objects • The eventgateway log file Event gateway application models Event gateway applications follow one or both of the following models: • Responder applications: Where event messages from external sources initiate a response from a ColdFusion listener CFC • Initiator applications: Where a ColdFusion application generates event messages to send out using the event gateway Unlike other ColdFusion applications, responder applications are request-free. They do not have CFM pages, just CFCs, and they do not respond to HTTP requests. Instead, ColdFusion the event gateway service deliver the event messages directly to the listener CFC, and the CFC listener method returns any response directly to the event gateway service. Applications that allow mobile phone owners to get a news feed, check for text messages, or request other forms of information follow this model. Initiator applications are similar to most ColdFusion applications. At some point, ColdFusion executes a CFM page in response to a request. (The request could be initiated by the ColdFusion Administrator Scheduled Tasks page.) ColdFusion sends a message to the event gateway when the application calls a CFML SendGatewayMessage function. An application that uses SMS to notify customers when orders have been shipped follows this model. Sending information to the event gateway A ColdFusion application can send an outgoing message to the event gateway in either of the following ways: • In a cfreturn tag in the listener CFC’s listener method • By calling the ColdFusion SendGatewayMessage function The first method is useful to automatically respond to incoming messages. Some complex applications that respond to incoming messages might use the SendGatewayMessage function either in place or in addition to the return value. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 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 “Using the GatewayHelper object” on page 1074. For more infor- mation on the instant messaging GatewayHelper object, see “Sample IM message handling application” on page 1088. The example code in “Example event gateway CFC” on page 1072 shows the use of a listener return value, and indicates 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 needs to 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 onIncomingMessage. (You can change the SMS event gateway listener method name in the event gateway configu- ration file.) The ColdFusion XMPP IM event gateway expects the listener CFC to have five methods: onIncomingMessage, onAddBuddyRequest, onAddBuddyResponse, onBuddyStatus, and onIMServerMessage. By default, if the event gateway does not specify the method name, ColdFusion calls the listener CFC’s onIncomingMessage method. For the sake of consistency, Adobe recommends that any event gateway with a single listener method use the onIncomingMessage method. The listener method does the following: 1 Takes a single parameter, a CFEvent structure, described in the following section. 2 Processes the contents of the instance as required by the application. 3 Optionally, returns an outgoing message to the event gateway in a cfreturn tag. It can also send a message back to the event gateway by calling the ColdFusion SendGatewayMessage function. The following code shows a listener CFC with an onIncomingMessage method that echoes a message back to the 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. <cfcomponent displayname="echo" hint="echo messages from the event gateway"> <cffunction name="onIncomingMessage" output="no"> <cfargument name="CFEvent" type="struct" required="yes"> <! Create a return structure that contains the message. > <cfset retValue = structNew()> <cfset retValue.DestinationID = arguments.CFEvent.OriginatorID> <cfset retValue.MESSAGE = "Echo: " & arguments.CFEvent.Data.MESSAGE> <! Send the return message back. > <cfreturn retValue> </cffunction> </cfcomponent> [...]... ADOBE COLDFUSION 8 107 ColdFusion Developer’s Guide Field Use cfcpath Overrides the CFC path specified in the ColdFusion Administrator This field lets you use a single gateway configuration in the ColdFusion 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. .. same application name as your CFC ADOBE COLDFUSION 8 107 ColdFusion Developer’s Guide • Use cflog tags to help you trace any errors by logging significant events to a file Also, carefully inspect the eventgateway.log and exceptions.log files that ColdFusion maintains For more information on using the eventgateway.log file, see “The eventgateway.log file” on page 106 6 • You can simulate responses from... The gatewayID value is the event gateway ID that you set in the ColdFusion Administrator, and gatewayType and originatorID are the values that the event gateway sets in the CFEvent instance for an incoming message ADOBE COLDFUSION 8 107 ColdFusion Developer’s Guide Application scope The Application scope lets the CFC share data with any ColdFusion page or CFC that uses the same application name This... application, such as the weather report or dictionary lookup (definition.cfc) ADOBE COLDFUSION 8 108 ColdFusion Developer’s Guide Use the menu application with the Socket event gateway 1 On the Gateway Settings page in the ColdFusion Administrator, click the Start SMS Test Server button 2 On the Gateways page in the ColdFusion Administrator, start the SMS Menu App - 5551212 event gateway by clicking... configure the gateway instance in the ColdFusion Administrator The gateway passes outgoing messages from this CFC and from other CFML code to the IM server The IM event gateway also provides a number of helper methods for managing the gateway and its configuration information ADOBE COLDFUSION 8 108 ColdFusion Developer’s Guide Incoming message handling You write the following ColdFusion CFC methods to handle... handling application” on page 108 8 Sending outgoing messages You use the SendGatewayMessage CFML function or the return value of a CFC listener method to send outgoing messages The ColdFusion IM gateway accepts the following outgoing message commands: Command Description submit (Default) Sends a normal message to another IM user ADOBE COLDFUSION 8 108 ColdFusion Developer’s Guide Command Description accept... configure a gateway to use both CFCs by entering the paths to the two CFCs, separated by a comma, in the CFC Path field of the Add/Edit ColdFusion Event Gateways form on the Gateways page in the ColdFusion Administrator ADOBE COLDFUSION 8 108 ColdFusion Developer’s Guide Phone directory lookup CFC The following CFC implements a simple employee phone directory lookup application The user sends an instant... cflog tag to log a message to a file in the ColdFusion logs directory The CFC takes a message with the following fields: • file The name of the file in which to put the message The default value is defaultEventLog • type The cflog type attribute to use The default value is info • message The message text ADOBE COLDFUSION 8 107 ColdFusion Developer’s Guide . receives when an event is triggered. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 Event gateway: Java code that receives events and sends them to and from ColdFusion application code. This document. CFC CFM Page . . . . . . . . . ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 Each event gateway instance communicates with one or more listener CFCs through the ColdFusion event gateway service gateway type-specific configuration information. ADOBE COLDFUSION 8 ColdFusion Developer’s Guide 106 Event gateway facilities and tools ColdFusion provides a number of features and tools for

Ngày đăng: 14/08/2014, 10:22

TỪ KHÓA LIÊN QUAN