@ConfigRoot(name="mongodb", phase=RUN_TIME) public class MongodbConfig extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_NAME |
MongoClientConfig |
defaultMongoClientConfig
The default mongo client connection.
|
Map<String,MongoClientConfig> |
mongoClientConfigs
Configures additional mongo client connections.
|
| Constructor and Description |
|---|
MongodbConfig() |
public static final String CONFIG_NAME
@ConfigItem(name="<<parent>>") public MongoClientConfig defaultMongoClientConfig
@ConfigItem(name="<<parent>>") public Map<String,MongoClientConfig> mongoClientConfigs
each cluster have a unique identifier witch must be identified to select the right connection. example:
quarkus.mongodb.cluster1.connection-string = mongodb://mongo1:27017 quarkus.mongodb.cluster2.connection-string = mongodb://mongo2:27017,mongodb://mongo3:27017
And then use annotations above the instances of MongoClient to indicate which instance we are going to use
@MongoClientName("cluster1")
@Inject
ReactiveMongoClient mongoClientCluster1
Copyright © 2020 JBoss by Red Hat. All rights reserved.