Testing the Client Heartbeat

The next step is to test a simple case where the client sends a dummy heartbeat to the server. The ultimate goal is for the client heartbeat to carry the delivery confirmations so that the server can resend the undelivered messages until they either get delivered or time out.

Figure 5-1 highlights all classes that are involved in sending the client heartbeat. Notice two projects: com.farata.rtmp.components, the Flex library project, and com.farata.rtmp.demo, a combined Eclipse JEE Flex/Java/Dynamic Web Project. For messaging, we are using RTMP messaging via LiveCycle Data Services.

Panorama of ClientHeartbeat classes

Figure 5-1. Panorama of ClientHeartbeat classes

To test the client heartbeat, run the application TestClientHeartbeat.mxml (Example 5-6) and click the Start Client Heartbeat button. Watch how the server log gets populated with the log records made by the custom HeartbeatAdapter (Figure 5-2).

Example 5-6. TestClientHeartbeat.mxml

<?xml version="1.0" encoding="utf-8"?> <!--TestClientHeartbeat.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:fx="http://www.faratasystems.com/2009/components" layout="vertical" frameRate="10"> <fx:ClientHeartbeatProducer id="clientHeartbeat" /> <mx:Script><![CDATA[ import com.farata.messaging.messages.ClientHeartbeatMessage; //Mention the class to ensure that it's linked into SWF ClientHeartbeatMessage; ]]> </mx:Script> <mx:HBox> ...

Get Agile Enterprise Application Development with Flex now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.