Replication conventions
FailoverBehavior
This conventions tells the client how it should behave in a replicated environment when the primary node is unreachable and need to failover to secondary node(s). Detailed description you will find here.
conventions.setFailoverBehavior(FailoverBehaviorSet.of(FailoverBehavior.ALLOW_READS_FROM_SECONDARIES));
ReplicationInformerFactory
This is called to provide replication behavior for the client. You can customize this to inject your own replication / failover logic by implementing IDocumentStoreReplicationInformer
.
conventions.setReplicationInformerFactory(new ReplicationInformerFactory() {
@Override
public IDocumentStoreReplicationInformer create(String url, HttpJsonRequestFactory jsonRequestFactory) {
return new ReplicationInformer(conventions, jsonRequestFactory);
}
});
IndexAndTransformerReplicationMode
It allows to change the replication mode for index and transformer definitions when they are created (or changed) by the client code (AbstractIndexCreationTask.execute
/ AbstractTransformerCreationTask.execute
). The possible values are:
None
- neither indexes nor transformers are updated to replicated instances,Indexes
- all created indexes are replicated.Transformers
- all transformers are replicated.
By default both indexes and transformers are uploaded to the replication nodes:
conventions.setIndexAndTransformerReplicationMode(EnumSet.of(IndexAndTransformerReplicationMode.INDEXES,
IndexAndTransformerReplicationMode.TRANSFORMERS));