Testing Ordered Delivery of Client Messages

To test ordered delivery of the client messages, register SerializingRTMPEndpoint with services-config.xml (Example 5-35).

Example 5-35. Channel definition to test ordered delivery of client messages

<channel-definition id="my-serializing-server-rtmp"
   class="mx.messaging.channels.RTMPChannel">
   <endpoint uri="rtmp://{server.name}:2043"
      class="com.farata.messaging.endpoints.SerializingRTMPEndpoint"
<properties>
          <idle-timeout-minutes>20</idle-timeout-minutes>
      </properties>
</channel-definition>

Then add the destination clientServiceTest to messaging-config.xml (Example 5-36).

Example 5-36. Messaging destination to test ordered delivery of client messages

<destination id="clientSequenceTest">
      <adapter ref="actionscript"/>
   <channels>
        <channel ref="my-serializing-server-rtmp" />
   </channels>
</destination>

The code of the testing application TestClientSequence is presented in Example 5-37.

The test application sends messages in random order, which is reflected in the Sent bar (Figure 5-13). The application is subscribed to MessageAckEvent and displays arrived messages in the Acknowledged bar with circles.

Notice that all messages came acknowledged in the right order, thanks to the housekeeping done by the SerializingEndpoint. In Example 5-37, you can also browse the server log produced by this custom endpoint during the specific test run.

Running the TestClientSequence application

Figure 5-13. Running ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.