public class InternalMongoConnector extends java.lang.Object implements MongoConnector
MongoConnector that owns the lifecycle of MongoClient.| Constructor and Description |
|---|
InternalMongoConnector(com.mongodb.WriteConcern writeConcern,
java.util.List<com.mongodb.ServerAddress> seeds,
java.util.Optional<com.mongodb.MongoCredential> credentials,
com.mongodb.MongoClientSettings.Builder settingsBuilder,
java.lang.String dbName)
Constructs an instance of
InternalMongoConnector. |
InternalMongoConnector(com.mongodb.WriteConcern writeConcern,
java.lang.String uri,
java.lang.String dbName)
Constructs an instance of
InternalMongoConnector from connection URI. |
InternalMongoConnector(com.mongodb.WriteConcern writeConcern,
java.lang.String uri,
java.lang.String dbName,
com.mongodb.MongoClientSettings.Builder settingsBuilder)
Constructs an instance of
InternalMongoConnector from connection URI and option builder. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Quartz-mongodb will call this method when shutting down.
|
com.mongodb.client.MongoCollection<org.bson.Document> |
getCollection(java.lang.String collectionName)
Quartz-mongodb will call this method to get the instance of
MongoCollection for internal uses. |
public InternalMongoConnector(com.mongodb.WriteConcern writeConcern,
java.lang.String uri,
java.lang.String dbName)
throws org.quartz.SchedulerConfigException
InternalMongoConnector from connection URI.writeConcern - instance of WriteConcern. Each MongoCollection produced by
getCollection(String) will be configured with this write concern.uri - MongoDB connection URI.dbName - name of the database that will be used to produce collections.org.quartz.SchedulerConfigException - if failed to create instance of MongoClient.public InternalMongoConnector(com.mongodb.WriteConcern writeConcern,
java.lang.String uri,
java.lang.String dbName,
com.mongodb.MongoClientSettings.Builder settingsBuilder)
throws org.quartz.SchedulerConfigException
InternalMongoConnector from connection URI and option builder.writeConcern - instance of WriteConcern. Each MongoCollection produced by
getCollection(String) will be configured with this write concern.uri - MongoDB connection URI.dbName - name of the database that will be used to produce collections.settingsBuilder - default settings builder.org.quartz.SchedulerConfigException - if failed to create instance of MongoClient.public InternalMongoConnector(com.mongodb.WriteConcern writeConcern,
java.util.List<com.mongodb.ServerAddress> seeds,
java.util.Optional<com.mongodb.MongoCredential> credentials,
com.mongodb.MongoClientSettings.Builder settingsBuilder,
java.lang.String dbName)
throws org.quartz.SchedulerConfigException
InternalMongoConnector.writeConcern - instance of WriteConcern. Each MongoCollection produced by
getCollection(String) will be configured with this write concern.seeds - list of server addresses.credentials - credentials used to authenticate all connections.settingsBuilder - default settings builder.dbName - name of the database that will be used to produce collections.org.quartz.SchedulerConfigException - if failed to create instance of MongoClient.public com.mongodb.client.MongoCollection<org.bson.Document> getCollection(java.lang.String collectionName)
MongoConnectorMongoCollection for internal uses.
The collection is expected to be fully configured with correct WriteConcern.getCollection in interface MongoConnectorcollectionName - collection name.MongoCollection.public void close()
MongoConnectorMongoClient here.close in interface MongoConnectorclose in interface java.io.Closeableclose in interface java.lang.AutoCloseable