Asynchronous Operation Replay

Upload operation replay records asynchronously.

When an application calls submitPending on an MBO on which a create, update, or delete operation is performed, an operation replay record is created on the device local database.

When synchronize is called, the operation replay records are uploaded to the server. The method returns without waiting for the backend to replay those records. The synchronize method downloads all the latest data changes and the results of the previously uploaded operation replay records that the backend has finished replaying. If you choose to disable asynchronous operation replay, each synchronize call will wait for the backend to finish replaying all the current uploaded operation replay records.

This feature is enabled by default. You can enable or disable the feature by setting the asyncReplay property in the synchronization profile. The following code shows how to disable asynchronous replay:
SUP101DB.getSynchronizationProfile().setAsyncReplay(false);
When asynchronous replay is enabled and the replay is finished, the onSynchronize callback method is invoked with a SynchronizationStatus value of SynchronizationStatus.ASYNC_REPLAY_COMPLETED. Use this callback method to invoke a synchronize call to pull in the results, as shown in the following callback handler.
public class MyCallbackHandler extends DefaultCallbackHandler
{
  public int onSynchronize(ObjectList groups, SynchronizationContext context)
  {
    switch(context.getStatus())
    {
      case SynchronizationStatus.ASYNC_REPLAY_UPLOADED:
        LogMessage("AsyncReplay uploaded");
        break;
      case SynchronizationStatus.ASYNC_REPLAY_COMPLETED:
        // operation replay finished, return SynchronizationAction.CONTINUE
        // will start a background synchronization to pull in the results.
        LogMessage("AsyncReplay Done");
        break;
      default:
        break;
    }

    return SynchronizationAction.CONTINUE;
  } 
}