Testing Guaranteed Delivery from the Client

To test guaranteed delivery of the messages originated on the client, register ResendingRTMPChannel with service-config.xml as shown in Example 5-30.

Example 5-30. Endpoint for testing the No Client Message Left Behind solution

<channel-definition id="my-resending-client-rtmp"
       class="com.farata.messaging.channels.ResendingRTMPChannel"
  <endpoint uri="rtmp://{server.name}:2042"
       class="com.farata.messaging.endpoints.AcknowledgingRTMPEndpoint"/>
          <properties>
              <idle-timeout-minutes>20</idle-timeout-minutes>
          </properties>
</channel-definition>

Next, define the destination clientDeliveryTest in messaging-config.xml (Example 5-31).

Example 5-31. Messaging destination to test the No Client Message Left Behind solution

<destination id="clientDeliveryTest">
    <adapter ref="actionscript"/>
    <channels>
       <channel ref="my-resending-client-rtmp" />
    </channels>
</destination>

The testing application TestClientDelivery (Example 5-32) displays seqNo from the headers of the messages sent by the producer and, separately, lastProcessedNo from the headers of the acknowledgment messages that the server replies with. Figure 5-11 illustrates a particular run of the application when messages 7 and 3 were “swallowed” by ResendingRTMPChannel, emulating a loss of the messages elsewhere in the network. As a result, these messages were resent by the channel, albeit a bit later. The corresponding server log is presented in Example 5-33.

Example 5-32 lists the source code of the testing ...

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.