Class MongoClients

java.lang.Object
io.quarkus.mongodb.runtime.MongoClients

@Singleton public class MongoClients extends Object
This class is sort of a producer for MongoClient and ReactiveMongoClient.

It isn't a CDI producer in the literal sense, but it is marked as a bean and its createMongoClient and createReactiveMongoClient methods are called at runtime in order to produce the actual client objects.

  • Constructor Details

    • MongoClients

      public MongoClients(MongodbConfig mongodbConfig, MongoClientSupport mongoClientSupport, jakarta.enterprise.inject.Instance<org.bson.codecs.configuration.CodecProvider> codecProviders, io.quarkus.tls.TlsConfigurationRegistry tlsConfigurationRegistry, jakarta.enterprise.inject.Instance<org.bson.codecs.pojo.PropertyCodecProvider> propertyCodecProviders, jakarta.enterprise.inject.Instance<com.mongodb.event.CommandListener> commandListeners, jakarta.enterprise.inject.Instance<com.mongodb.reactivestreams.client.ReactiveContextProvider> reactiveContextProviders, @Any jakarta.enterprise.inject.Instance<MongoClientCustomizer> customizers, io.vertx.core.Vertx vertx)
  • Method Details

    • createMongoClient

      public com.mongodb.client.MongoClient createMongoClient(String clientName) throws com.mongodb.MongoException
      Throws:
      com.mongodb.MongoException
    • createReactiveMongoClient

      public ReactiveMongoClient createReactiveMongoClient(String clientName) throws com.mongodb.MongoException
      Throws:
      com.mongodb.MongoException
    • getMatchingMongoClientConfig

      public MongoClientConfig getMatchingMongoClientConfig(String clientName)
    • stop

      @PreDestroy public void stop()