primaryFor
public ConnectionContext.MongoPrimary primaryFor(ReplicaSet replicaSet,
Filters filters,
BiConsumer<String,Throwable> errorHandler)
Obtain a client that will repeatedly try to obtain a client to the primary node of the replica set, waiting (and using
this context's back-off strategy) if required until the primary becomes available.
- Parameters:
replicaSet- the replica set information; may not be nullfilters- the filter configurationerrorHandler- the function to be called whenever the primary is unable toexecutean operation to completion; may be null- Returns:
- the client, or
nullif no primary could be found for the replica set