Callback Handler API

The SUPCallbackHandler protocol is invoked when any database event occurs. A default callback handler is provided, which basically does nothing. You should implement a custom CallbackHandler to register important events. The callback is invoked on the thread that is processing the event. A callback handler provides message notifications and success or failure messages related to message-based synchronization. To receive callbacks, register your own handler with a database. You can use SUPDefaultCallbackHandler as the base class. In your handler, override the particular callback you want to use (for example, onReplaySuccess).

Because both the database and entity handler can be registered, your handler may get called twice for a mobile business object import activity. The callback is executed in the thread that is performing the action. For example, onReplaySuccess is always called from a thread other than the main application thread.

When you receive the callback, the particular activity is already complete.

The SUPCallbackHandler protocol consists of these callbacks:

This code example shows how to register a handler to receive a callback:

DBCallbackHandler* handler = [DBCallbackHandler newHandler];
[iPhoneSMTestDB registerCallbackHandler:handler];
[handler release];

MBOCallbackHandler* mboHandler = [MBOCallbackHandler newHandler];
[Product registerCallbackHandler:mboHandler];
[mboHandler release];