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.

In your handler, override the particular callback that you are interested in (for example, OnReplayFailure). 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. The CallbackHandler interface consists of the following callbacks:

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 will be invoked at the specified status of the synchronization.groups is a list of synchronization group names. context is the synchronization context.

The following code example 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);
//or Customer.registerCallbackHandler(handler);