Callback Handlers

To receive callbacks, you must register a CallBackHandler with the generated database class, the entity class, or both. You can create a handler by extending the DefaultCallbackHandler class or by implementing the com.sybase.persistence.CallbackHandler interface.

In your handler, override the particular callback that you are interested in (for example, void onReplayFailure(java.lang.Object entity) ). The callback is executed in the thread that is performing the action (for example, replay). When you receive the callback, the particular activity is already complete.

Callbacks in the CallbackHandler Interface
Callback Description
void onReplayFailure(java.lang.Object entity) Replay failure response notification. entity is a client MBO instance.
void onReplaySuccess(java.lang.Object entity) Replay success response notification. entity is a client MBO instance.
int onSynchronize(com.sybase.collections.ObjectList groups,SynchronizationContext context)

This method is invoked at the specified status of the synchronization.groups is a list of synchronization group names. context is the synchronization context.

This method can only be received from the generated database class.

This code shows how to create and register a handler to receive callbacks:

public class MyCallbackHandler extends DefaultCallbackHandler
{
    // implementation
}

CallbackHandler handler = new MyCallbackHandler();
<PkgName>DB.registerCallbackHandler(handler);