我已经创建了一个带有拉取和推送选项的复制器,但问题是我需要从 Couchbase 服务器获取一些文档而无法推送。谁能帮我解决这个问题?注意:我使用的是 couchbase lite 2.5、couchbase server 6.0 和 sync gateway 2.5
我当前的推拉复制器
public static void startPushAndPullReplicationForCurrentUser(String username, String password) {
Log.e("Replication", "startPushAndPullReplicationForCurrentUser");
URI url = null;
try {
url = new URI(mSyncGatewayEndpoint);
} catch (URISyntaxException e) {
e.printStackTrace();
}
ReplicatorConfiguration config = new ReplicatorConfiguration(database, new URLEndpoint(url));
config.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PUSH_AND_PULL);
config.setContinuous(true);
config.setAuthenticator(new BasicAuthenticator(username, password));
Replicator replicator = new Replicator(config);
replicator.addChangeListener(new ReplicatorChangeListener() {
@Override
public void changed(ReplicatorChange change) {
if (change.getReplicator().getStatus().getActivityLevel().equals(Replicator.ActivityLevel.IDLE)) {
Log.e("Replication Comp Log", "Schedular Completed");
}
if (change.getReplicator().getStatus().getActivityLevel().equals(Replicator.ActivityLevel.STOPPED)
|| change.getReplicator().getStatus().getActivityLevel().equals(Replicator.ActivityLevel.OFFLINE)) {
// stopReplication();
Log.e("Rep schedular Log", "ReplicationTag Stopped");
}
}
});
replicator.start();
}
所有数据库都附加到推拉复制器,但这是错误的。
慕神8447489
阿波罗的战车
相关分类