@CompileStatic class MongoConnectionSourceFactory extends AbstractConnectionSourceFactory<com.mongodb.client.MongoClient, MongoConnectionSourceSettings>
A factory for building com.mongodb.client.MongoClient instances
| Type | Name and description |
|---|---|
com.mongodb.MongoClientSettings$Builder |
clientOptionsBuilderThe client options builder |
java.util.List<MongoClientSettingsBuilderCustomizer> |
clientSettingsCustomizersOptional customizers applied to the MongoClientSettings.Builder of the default connection source before the com.mongodb.client.MongoClient is created. |
org.bson.codecs.configuration.CodecRegistry |
codecRegistryAn optional additional registry |
java.util.List<org.bson.codecs.Codec> |
codecsOptional additional codecs |
| Constructor and description |
|---|
MongoConnectionSourceFactory() |
| Type Params | Return Type | Name and description |
|---|---|---|
<F extends ConnectionSourceSettings> |
MongoConnectionSourceSettings |
buildRuntimeSettings(java.lang.String name, PropertyResolver configuration, F fallbackSettings) |
<F extends ConnectionSourceSettings> |
protected MongoConnectionSourceSettings |
buildSettings(java.lang.String name, PropertyResolver configuration, F fallbackSettings, boolean isDefaultDataSource) |
|
ConnectionSource<com.mongodb.client.MongoClient, MongoConnectionSourceSettings> |
create(java.lang.String name, MongoConnectionSourceSettings settings)Creates the connection and its client. |
|
java.io.Serializable |
getConnectionSourcesConfigurationKey() |
The client options builder
Optional customizers applied to the MongoClientSettings.Builder of the
default connection source before the com.mongodb.client.MongoClient is created. This is the
supported hook for settings that have no grails.mongodb.* equivalent — e.g.
registering a driver com.mongodb.event.CommandListener for metrics/tracing.
An optional additional registry
Optional additional codecs
Creates the connection and its client. A subclass that builds the client itself should return a MongoConnectionSource, whose client a datastore can replace: it closes the clients when it is stopped for a CRaC checkpoint, and puts the ones it builds for the restore where the closed ones were, so that whatever reads a client from the connection source gets the one in use.