ColdFusion includes the Data Services Messaging event gateway, which uses the ColdFusion event Gateway Adapter to send messages to and receive messages from the LiveCycle Data Services ES. This means that ColdFusion applications and Flex applications can publish to and consume events from the same event queue.
Note: To use the Data Services Messaging event gateway to interact with a Flex application, the Flex application must be running on LiveCycle Data Services ES.
How ColdFusion and Flex interact
You can send messages from a ColdFusion application to a Flex application, through the Data Services Messaging event gateway. Conversely, you can send messages from a Flex application to a ColdFusion application.
Either the ColdFusion application or the Flex application can initiate sending a message. The following image shows the message handling process in which a message is sent from the Flex application to the ColdFusion application, and then from the ColdFusion application to the Flex application.
- The Flex application generates a message.
- The Flex Message Service passes the message to the ColdFusion Event Gateway Adapter.
- The ColdFusion Event Gateway Adapter sends the message to the Data Services Messaging event gateway, by using Java Remote Method Invocation (Java RMI).
- The Data Services Messaging event gateway and the ActionScript translator convert ActionScript 3.0 data types to the appropriate ColdFusion values and add the message to the event gateway queue.
- The ColdFusion server invokes the onIncomingMessage method of the Data Services Messaging event gateway listener CFC.
- The ColdFusion application generates a message, which it sends to the ColdFusion server.
- The ColdFusion server sends the message to the Data Services Messaging event gateway.
- The Data Services Messaging event gateway and the ActionScript translator convert ColdFusion values to the appropriate ActionScript 3.0 data types and then the gateway sends the message to the ColdFusion Event Gateway Adapter.
- The ColdFusion Event Gateway Adapter sends the message to the Flex Message Service.
- The Flex Message Service passes the message to the Flex application.
Note: The RMI registry, which facilitates communication between the ColdFusion Event Gateway Adapter and the Data Services Messaging event gateway uses port 1099, which is the default port for Java RMI. You cannot change this port number. To ensure that the RMI registry provides registry service for both Flex Enterprise Services 2 and ColdFusion, start Flex Enterprise Services 2 first, and then start ColdFusion. If you stop Flex, you must restart Flex Enterprise Services 2, and then restart the gateway.
Application development and deployment process
The following is a typical process for developing and deploying a ColdFusion application that communicates with a Flex application through the Data Services Messaging event gateway:
- Design your application.
- Configure a Data Services Messaging event gateway instance.
- Write your ColdFusion CFCs, CFM pages, and any other application elements.
- Test your application using Flex Enterprise Services 2.
- Make the application publicly available.