This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new 2628871 Improve MongoDB extension documentation of named clients 2628871 is described below commit 2628871a1c71dae10fdd96eb7578c899f8a96cc6 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Tue Apr 13 08:56:29 2021 +0100 Improve MongoDB extension documentation of named clients Fixes #2466 --- docs/modules/ROOT/pages/reference/extensions/mongodb.adoc | 11 ++++++++--- extensions/mongodb/runtime/src/main/doc/configuration.adoc | 13 +++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/modules/ROOT/pages/reference/extensions/mongodb.adoc b/docs/modules/ROOT/pages/reference/extensions/mongodb.adoc index 9ad6a18..848f125 100644 --- a/docs/modules/ROOT/pages/reference/extensions/mongodb.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/mongodb.adoc @@ -50,7 +50,7 @@ The Camel Quarkus MongoDB extension automatically registers a MongoDB client bea from("direct:start") .to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll") -You can also create a "named" client and reference in your route by injecting a client and the related configuration as explained in the https://quarkus.io/guides/mongodb#named-mongo-client-injection[Quarkus MongoDB extension client injection]. For example: +If your application needs to work with multiple MongoDB servers, you can create a "named" client and reference in your route by injecting a client and the related configuration as explained in the https://quarkus.io/guides/mongodb#named-mongo-client-injection[Quarkus MongoDB extension client injection]. For example: .... //application.properties @@ -67,9 +67,14 @@ quarkus.mongodb.mongoClient1.connection-string = mongodb://root:example@localhos @Override public void configure() throws Exception { - from("direct:start") - .to("mongodb:mongoClient1?database=myDb&collection=myCollection&operation=findAll"); + from("direct:defaultServer") + .to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll") + + from("direct:otherServer") + .to("mongodb:mongoClient1?database=myOtherDb&collection=myOtherCollection&operation=findAll"); } } .... +Note that when using named clients, the "default" `camelMongoClient` bean will still be produced. Refer to the Quarkus documentation on https://quarkus.io/guides/mongodb#multiple-mongodb-clients[Multiple MongoDB Clients] for more information. + diff --git a/extensions/mongodb/runtime/src/main/doc/configuration.adoc b/extensions/mongodb/runtime/src/main/doc/configuration.adoc index cfc40dd..960f140 100644 --- a/extensions/mongodb/runtime/src/main/doc/configuration.adoc +++ b/extensions/mongodb/runtime/src/main/doc/configuration.adoc @@ -7,7 +7,7 @@ The Camel Quarkus MongoDB extension automatically registers a MongoDB client bea from("direct:start") .to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll") -You can also create a "named" client and reference in your route by injecting a client and the related configuration as explained in the https://quarkus.io/guides/mongodb#named-mongo-client-injection[Quarkus MongoDB extension client injection]. For example: +If your application needs to work with multiple MongoDB servers, you can create a "named" client and reference in your route by injecting a client and the related configuration as explained in the https://quarkus.io/guides/mongodb#named-mongo-client-injection[Quarkus MongoDB extension client injection]. For example: .... //application.properties @@ -24,8 +24,13 @@ quarkus.mongodb.mongoClient1.connection-string = mongodb://root:example@localhos @Override public void configure() throws Exception { - from("direct:start") - .to("mongodb:mongoClient1?database=myDb&collection=myCollection&operation=findAll"); + from("direct:defaultServer") + .to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll") + + from("direct:otherServer") + .to("mongodb:mongoClient1?database=myOtherDb&collection=myOtherCollection&operation=findAll"); } } -.... \ No newline at end of file +.... + +Note that when using named clients, the "default" `camelMongoClient` bean will still be produced. Refer to the Quarkus documentation on https://quarkus.io/guides/mongodb#multiple-mongodb-clients[Multiple MongoDB Clients] for more information.