Example usage for com.mongodb.connection ClusterSettings.Builder requiredClusterType

List of usage examples for com.mongodb.connection ClusterSettings.Builder requiredClusterType

Introduction

In this page you can find the example usage for com.mongodb.connection ClusterSettings.Builder requiredClusterType.

Prototype

ClusterType requiredClusterType

To view the source code for com.mongodb.connection ClusterSettings.Builder requiredClusterType.

Click Source Link

Usage

From source file:org.jooby.mongodb.MongoRx.java

License:Apache License

static ClusterSettings cluster(final ConnectionString cstr, final Config conf) {
    ClusterSettings.Builder cluster = ClusterSettings.builder().applyConnectionString(cstr);
    withConf("cluster", conf, c -> {
        withInt("maxWaitQueueSize", c, cluster::maxWaitQueueSize);
        withStr("replicaSetName", c, cluster::requiredReplicaSetName);
        withStr("requiredClusterType", c,
                v -> cluster.requiredClusterType(ClusterType.valueOf(v.toUpperCase())));
        withMs("serverSelectionTimeout", c, s -> cluster.serverSelectionTimeout(s, TimeUnit.MILLISECONDS));
    });/*from  w  ww. j a va  2s.  c o m*/
    return cluster.build();
}