Using the FMS event gateway



The FMS event gateway provides interfaces between the Flash Media Server 2 and the Adobe ColdFusion server. As a result, ColdFusion applications and Adobe Flash clients can share data.

Before you use the gateway, become familiar with ColdFusion event gateway principles and programming techniques (see Using Event Gateways). A basic knowledge of Flash Media Server is also helpful.

About Flash Media Server

Flash Media Server 2 is the newest version of Flash Communication Server. Flash Media Server 2 offers traditional streaming media capabilities and a flexible development environment for creating and delivering innovative, interactive media applications. You can use Flash Media Server to create and deliver the following media experiences:

  • Video on Demand

  • Live web-event broadcasts

  • Mp3 streaming

  • Video blogging

  • Video messaging

  • Multimedia chat environments

To learn more about and to download the Flash Media Server, go to the Adobe website. at www.adobe.com/go/learn_cfu_flashmediaserver_en.

How ColdFusion and Flash Media Server interact through the FMS gateway

The FMS event gateway lets you modify data through the ColdFusion application or the Flash client, and reflect the change in the Flash Media Server shared object. The FMS event gateway listens to the shared object, and notifies ColdFusion when other clients modify shared objects. The FMS event gateway also lets ColdFusion modify shared objects.

ColdFusion provides the following tools for developing FMS applications:

FCSj.jar
The JAR file that implements the Java API to communicate with Flash Media Server.

FMSGateway
The class for the FMS event gateway type. You implement your FMS application by creating a ColdFusion application that uses an instance of the FMSGateway class to communicate with one or more Flash Media Server.

Modifying data in the Flash client

The FMS event gateway listens to Flash Media Server shared objects, and notifies ColdFusion when a Flash client modifies a shared object. The following steps occur when a Flash client modifies a Flash Media Server shared object:

  1. A user modifies data in the Flash client.

  2. Flash Media Server updates the appropriate shared object.

  3. Flash Media Server notifies the FMS event gateway.

  4. The FMS event gateway calls the appropriate methods in CFCs in your ColdFusion application. These CFCs perform all actions required, including notifying the FMS Gateway Helper to update the shared object.

  5. The FMS Gateway Helper sends a message to the FMS event gateway to update the shared object.

  6. The FMS event gateway updates the shared object.

  7. Flash Media Server notifies all the Flash clients that it modified the shared object. As a result, the Flash clients reflect the change.

The following image shows the interaction between Flash Media Server, the FMS event gateway, and the ColdFusion application:

Modifying data in a ColdFusion application

The FMS event gateway lets ColdFusion applications modify Flash Media Server shared objects. The following steps occur when data that affects a shared object is modified in a ColdFusion application:

  1. The user submits a form that contains data to modify using a ColdFusion page.

  2. The ColdFusion page calls the appropriate CFC, which contains a method to update the database.

  3. The method in the CFC updates the database and calls a method in the FMS Gateway Helper.

  4. The FMS Gateway Helper calls the FMS event gateway to update the appropriate shared object.

  5. Flash Media Server updates the shared object.

  6. Flash Media Server notifies the Flash client that a shared object has changed.

  7. The Flash client makes the changes in its content as appropriate.

Application development and deployment process

The following is a typical process for developing and deploying an application that uses the FMS event gateway:

  1. Design your application.

  2. Configure an FMS event gateway instance to use the Flash Media Server.

  3. Write your ColdFusion CFCs, CFM pages, and any other application elements.

  4. Create or identify a Flash client that manipulates a Flash Media Server shared object to test your ColdFusion application.

  5. Test your application using Flash Media Server and the Flash client.

  6. Make the application publicly available.

Configuring an FMS event gateway

You provide FMS event gateway-specific configuration information to the FMS event gateway in a configuration file. You specify the configuration file location when you configure the FMS event gateway instance in the ColdFusion Administrator. The configuration file contains the URL of the Flash Media Server application and the name of the Flash Media Server shared object. The following example is a sample configuration file:

# 
# FMS event gateway configuration 
# 
 
# This is the URL to the Flash Media Server application. 
rtmpurl=rtmp://localhost/SalesDataApp 
 
# This is the shared object you would like this gateway to connect and listen to. 
sharedobject=SalesDataSO

FMS event gateway GatewayHelper class methods

The following table lists the FMS event gateway GatewayHelper class methods:

Method

Description

setProperty

Sets the property of the Flash Media Server shared object. The following parameters are valid:

name: The string that contains the name of the shared object.

value: The shared object.

getProperty

Gets the property of the Flash Media Server shared object. The following parameters are valid:

name: The string that contains the name of the shared object.

Data translation

ColdFusion and Flash Media Server use different data types; therefore, data translation is required to pass data from one to the other. In addition to basic data types such as numeric, String, and Boolean, you can pass ColdFusion queries, structures, and arrays to Flash Media Server. You pass a ColdFusion query object to Flash Media Server as an array of java.util.HashMap. Each HashMap object in the array contains a key-value pair for column names and values for each row in the query. When you pass a ColdFusion array to Flash Media Server, the FMS event gateway converts it to a Java array of objects. When you pass a ColdFusion structure, no conversion is required.

The FMS event gateway does not support passing CFCs in shared objects.