* @author Mike Brock
*/
public class ClientOTBusService {
public static void startOTService(final MessageBus messageBus, final OTEngine engine) {
messageBus.subscribe("ClientOTEngineSyncService", new MessageCallback() {
@Override
public void callback(Message message) {
final Integer value = message.getValue(Integer.class);
final OTPeer peer = engine.getPeerState().getPeer("<ServerEngine>");
peer.beginSyncRemoteEntity("<ServerEngine>", value, new StateEntitySyncCompletionCallback(engine, value,
new EntitySyncCompletionCallback<State>() {
@Override
public void syncComplete(OTEntity<State> entity) {
engine.getPeerState().notifyResync(entity);
}
}));
}
});
messageBus.subscribe("ClientOTEngine", new MessageCallback() {
@Override
public void callback(Message message) {
final OpDto opDto = message.getValue(OpDto.class);
if (opDto == null && message.hasPart("PurgeHint")) {