Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exploring Real-time apps with ColdFusion and Blaze DS / Live Cycle Data Services ES Dan Blackman www.muddbrick.com.

Similar presentations


Presentation on theme: "Exploring Real-time apps with ColdFusion and Blaze DS / Live Cycle Data Services ES Dan Blackman www.muddbrick.com."— Presentation transcript:

1 Exploring Real-time apps with ColdFusion and Blaze DS / Live Cycle Data Services ES Dan Blackman www.muddbrick.com

2 Dan Blackman Founder and Senior Consultant – –Mudd Brick Inc, Dallas, Tx Certified Adobe Instructor – Flex, ColdFusion, Flash Experience – 12 Years ColdFusion, Flash and Flex

3 Objectives Data Persistence: The Why!? Introducing Live Cycle Data Services Push vs Pull Messaging Configuring Message Channel / Destination Using the Message Service with ColdFusion Event Gateways Configuring the Event Gateway Producing and Consuming Messages Summary and Questions

4 Data Persistence: The Why!? Why use one over the other!?

5 Data Persistence: The Why? ColdFusion Request / Response Applications Flex Rich Internet Applications –Persisted data is NOT refreshed automatically –Stateful approach to managing data – No more session variables –Refreshed through manual client interactions or Actionscript Flex Real-time Applications –Persisted Data is refreshed via interactions with server –Stateful approach with server side synchronization –Refreshed through Polling, Long-Polling or RTMP –Data Management Service – Live Cycle service – provides data synchronization between Flex Clients

6 Data Persistence: The Why

7 Let’s take a look at Remote Object and the way it persists data

8 Introducing Live Cycle Data Services A Quick Look at Live Cycle Data Services – The How?

9 Introducing Live Cycle Data Services Live Cycle Data Services ES allows multiple applications to access data from the Flex Framework Consists of : –Flex Messaging Service –Flex Data Management –Flex Proxy Service –Remote Object Service

10 Introducing Live Cycle Data Services

11 Let’s review the Live Cycle Data Services Framework – ColdFusion 8 Go to c:\ColdFusion8\wwwroot\WEB-INF –web.xml jrun configuration file –flex directorycontains config files for LDS –classes directory location for compiled java classes –lib directorylocation for compiled.jar files

12 Push vs Pull Messaging Huh?

13 Push vs Pull Messaging Many approaches to Data Access: Simple AMF – Stateful Approach –Client Pull access initiated by user RTMP – Real Time Messaging Protocol –Maintains persistent connection –Allows real-time communication –Uses Java-NIO facilities – Scalable Solution Polling – Client Polling –Flex Client sends requests for messages periodically –Uses poll-wait-interval to set the time between requests –Less Scalable solution

14 Configuring Message Channel / Destination Let’s hit the road running

15 Configuring a Messaging Channel / Destination Determine how data is transferred to/ from the server by selecting an adapter. –Cfgateway: Messages sent between ColdFusion 8 and Flex Client –JMS adapter: Allows the use of both JMS and Flex clients to communicate –Actionscript Adapter: Flex Default adapter allows only Flex Clients to participate in communication.

16 Configuring a Messaging Channel / Destination Most channels are configured out-of-the box –wwwroot/WEB-INF/flex/Services-config.xml my-cf-amf cf-polling-amf cf-long-polling-amf cf-streaming-amf cf-rtmp

17 Configuring a Messaging Channel / Destination

18 Let’s review the Live Cycle Data Services Framework – ColdFusion 8 Go to c:\ColdFusion8\wwwroot\ –Go to the WEB-INF\flex directory –Open the services-config.xml and messaging- config.xml

19 Using the Message Service with ColdFusion Event Gateways The server side of things

20 Using ColdFusion Event Gateways ColdFusion Event Gateways: –provide communication over protocols other than HTTP. –communicate with various kinds of clients (including Flex Clients). –Server requirements: ColdFusion Enterprise Edition, version 7.02 or later LiveCycle Data Services 2

21 Using ColdFusion Event Gateways Start by creating a MessageGateway CFC: Use the data property to retrieve the data –event.data.body –event.data.headers

22 Using ColdFusion Event Gateways

23 Configuring the Event Gateway The server side of things continued

24 Configuring the Event Gateway Configure the Event Gateway after the MessageGateway CFC is created: –Open the ColdFusion Administrator and select Event Gateways > Gateway Instances. –Set the gateway properties as follows: GatewayID : A unique string identifier Gateway Type : DataServicesMessaging CFC Path : The CFC file name and path Startup Mode : Automatic

25 Configuring the Event Gateway Configure the Event Gateway after the CFC is created:

26 Producing and Consuming Messages Passing Data from Client to Server and back again

27 Producing and Consuming Messages Flex uses client-side components to handle publishing and consumption of messages Work together with messaging services in LCDS Simply point the Producer and Consumer to a valid Destination

28 Producing and Consuming Messages Two ways to Consume messages from a destination: <mx:Consumer id=“consumer" destination=“ColdFusionGateway“ message=“messageHandler(event)”/> import mx.messaging.Consumer; var crMessagingService:Consumer = new Consumer(); consumer.destination = “ColdFusionGateway";

29 Receiving and Processing Mesages Setting up Channel and Destination via Actionscript: public function initApp():void { var channel:AMFChannel = new AMFChannel(“my-cf-amf", "http://127.0.0.1/flex2gateway/"); consumer = new Consumer(); cons.destination = "ColdFusionGateway"; cons.channelSet = new ChannelSet(); cons.channelSet.addChannel(sAMF); cons.addEventListener(MessageAckEvent.ACKNOWLEDGE, ackHandler); cons.addEventListener(MessageEvent.MESSAGE, messageHandler); cons.addEventListener(MessageFaultEvent.FAULT, faultHandler); cons.subscribe(); } Automatically dispatches a MessageEvent when a message is received

30 Sending and Receiving Complex Data On the receiving end, handle the data through the messageHandler. public function handleNotificationsResult (event:MessageEvent):void { facebookNotifications = new XMLListCollection(event.message.body.channel..item); }

31 Let’s Look at some code…. Chat Application Collaborative Application Data Push Application in ColdFusion

32 Questions? Dan Blackman Mudd Brick Inc. dblackman@muddbrick.com Evals – mobile.cfunited.com dblackman@muddbrick.com


Download ppt "Exploring Real-time apps with ColdFusion and Blaze DS / Live Cycle Data Services ES Dan Blackman www.muddbrick.com."

Similar presentations


Ads by Google