Package io.quarkus.mongodb.runtime
Interface MongoConfig
@ConfigMapping(prefix="quarkus.mongodb")
@ConfigRoot(phase=RUN_TIME)
public interface MongoConfig
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@WithUnnamedKey("<default>") Map<String, MongoClientConfig> clients()Configures the Mongo clients.booleanThis property enables the logging ot the DNS lookup.Ifnative.dns.use-vertx-dns-resolveris set totrue, this property configures the DNS lookup timeout duration.This property configures the DNS server.This property configures the DNS server port.static StringgetPropertyName(String name, String attribute) static booleanisDefaultClient(String name) booleanDeprecated.This resolver is always used
-
Field Details
-
CONFIG_NAME
- See Also:
-
DEFAULT_CLIENT_NAME
- See Also:
-
-
Method Details
-
clients
@WithParentName @WithDefaults @WithUnnamedKey("<default>") @ConfigDocMapKey("mongo-client-name") @WithUnnamedKey("<default>") Map<String,MongoClientConfig> clients()Configures the Mongo clients.The default client does not have a name, and it is configured as:
quarkus.mongodb.connection-string = mongodb://mongo1:27017
And then useInjectto inject the client:@Inject MongoClient mongoClient;
Named clusters must be identified to select the right client:
quarkus.mongodb.cluster1.connection-string = mongodb://mongo1:27017 quarkus.mongodb.cluster2.connection-string = mongodb://mongo2:27017,mongodb://mongo3:27017
And then use theMongoClientNameannotation to select any of the beans:MongoClientReactiveMongoClient
@MongoClientName("cluster1") @Inject ReactiveMongoClient mongoClientCluster1 -
useVertxDnsResolverInNativeMode
@Deprecated @WithName("native.dns.use-vertx-dns-resolver") @WithDefault("false") boolean useVertxDnsResolverInNativeMode()Deprecated.This resolver is always usedThe default DNS resolver used to handlemongo+srv://urls cannot be used in a native executable. This option enables a fallback to use Vert.x to resolve the server names instead of JNDI. IMPORTANT: The resolution may be different in JVM mode using the default (JNDI-based) DNS resolver, and in native mode. This feature is experimental. -
dnsServer
This property configures the DNS server. If the server is not set, it tries to read the firstnameserverfrom/etc /resolv.conf(if the file exists), otherwise fallback to the default. -
dnsServerPort
This property configures the DNS server port. -
dnsLookupTimeout
Ifnative.dns.use-vertx-dns-resolveris set totrue, this property configures the DNS lookup timeout duration. -
dnsLookupLogActivity
@WithDefault("false") @WithName("dns.log-activity") boolean dnsLookupLogActivity()This property enables the logging ot the DNS lookup. It can be useful to understand why the lookup fails. -
isDefaultClient
-
getPropertyName
-