[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-940911000 Thanks for checking this out @oscerd. I tried applying the Kubernetes declaration above again and get the same error. `spec.source.ref.name: isgattchannel` is just arbitrarily set; am I free to use whatever name there? The Camel-K operator works in the same Red Hat CodeReady Containers cluster, so Knative seems to be working in some aspects there. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-940310492 Thanks @squakez, the [quarkus.mongodb...](https://camel.apache.org/camel-quarkus/latest/reference/extensions/mongodb.html) properties is what I was missing; I was stuck at https://camel.apache.org/components/3.12.x/mongodb-component.html but never reached this document without your help: https://camel.apache.org/camel-quarkus/latest/reference/extensions/mongodb.html The kamelets didn't work on my end; does that mean they are also not setting those properties correctly, or did I somehow fail to deploy them correctly? - example above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939086147 I could provide in a private message the exact MongoDB Atlas connection string I'm using, which is to a Free Tier Cluster and contains nothing important. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939083349 I'm using the Red Hat OpenShift Container Platform (CodeReady containers, locally on my workstation). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939080245 I should add that this works fine: ``` public class MongoDBTest extends RouteBuilder { @Override public void configure() throws Exception { com.mongodb.client.MongoClient mongoClient = com.mongodb.client.MongoClients.create("...connection string..."); String firstCollectionName = mongoClient.getDatabase("[myDb]").listCollectionNames().first(); System.out.println("--firstCollectionName:"+firstCollectionName); ``` - deployed in the same way as a Camel-K integration it correctly prints: ``` --firstCollectionName:myFirstCollection ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939065691 How does it work for you to run this integration? ``` // camel-k: language=java // camel-k: dependency=camel:mongodb // camel-k: dependency=camel:jackson // camel-k: dependency=mvn:org.mongodb:mongo-java-driver:3.12.10 import org.apache.camel.builder.RouteBuilder; public class MongoDBTest extends RouteBuilder { @Override public void configure() throws Exception { from("timer:java?period=1000") .routeId("java") .to("mongodb:mongoBean?hosts=[host1:port,host2:port,host3:port]=[user]=[pass]=[dbname]=[collection-name]=getDbStats") .to("log:info"); } } ``` - do you need further configuration, like in properties? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939063904 > With the kamelets, you'll get some complaints before the correct connection will be done > > But after that you'll get the correct connection, this is something related to underlined quarkus extension On my end it's just stuck in "CrashLoopBackOff". Does my deployment declaration above look OK ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939060540 Regarding the MongoDB sink kamelet, I tried again deploying the k8s declaration listed above, to grab the full logs which I'll paste in here in case the provide any insights: ``` exec java -cp ./resources:/etc/camel/application.properties:/etc/camel/conf.d/_resources:/etc/camel/conf.d/user.properties:/etc/camel/resources:/etc/camel/sources/camel-k-embedded-flow.yaml:/etc/camel/sources/mongodb-sink.yaml:dependencies/app/camel-k-integration-1.6.0.jar:dependencies/lib/boot/io.quarkus.quarkus-bootstrap-runner-2.2.0.Final.jar:dependencies/lib/boot/io.quarkus.quarkus-development-mode-spi-2.2.0.Final.jar:dependencies/lib/boot/io.smallrye.common.smallrye-common-io-1.6.0.jar:dependencies/lib/boot/org.glassfish.jakarta.json-1.1.6.jar:dependencies/lib/boot/org.graalvm.sdk.graal-sdk-21.2.0.jar:dependencies/lib/boot/org.jboss.logging.jboss-logging-3.4.2.Final.jar:dependencies/lib/boot/org.jboss.logmanager.jboss-logmanager-embedded-1.0.9.jar:dependencies/lib/boot/org.wildfly.common.wildfly-common-1.5.4.Final-format-001.jar:dependencies/lib/main/com.fasterxml.jackson.core.jackson-annotations-2.12.4.jar:dependencies/lib/main/com.fasterxml.jackson.core.jackson-core-2.12.4. jar:dependencies/lib/main/... [38;5;145m2021-10-08 19:07:56,131[39m[38;5;188m [39m[38;5;107mINFO [39m[38;5;188m [[39m[38;5;69morg.mon.dri.cluster[39m[38;5;188m] ([39m[38;5;71mmain[39m[38;5;188m) [39m[38;5;151mCluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='3 ms'}[39m[38;5;203m[39m[38;5;227m [39m[38;5;145m2021-10-08 19:07:56,171[39m[38;5;188m [39m[38;5;107mINFO [39m[38;5;188m [[39m[38;5;69morg.mon.dri.cluster[39m[38;5;188m] ([39m[38;5;71mmain[39m[38;5;188m) [39m[38;5;151mCluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='3 ms'}[39m[38;5;203m[39m[38;5;227m [39m[38;5;145m2021-10-08 19:07:56,220[39m[38;5;188m [39m[38;5;107mINFO [39m[38;5;188m [[39m[38;5;69morg.mon.dri.cluster[39m[38;5;188m] ([39m[38;5;71mcluster-ClusterId{value='6160970c21ccfd22aca10618', description='null'}-127.0.0.1:27017[39m[38;5;188m) [39m[38;5;151mException in monitor thread while connecting to server 127.0.0.1:27017[39m[38;5;203m: com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:165) at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:195) at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:151) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:609) at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:107) at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ... 4 more [39m[38;5;227m [39m[38;5;145m2021-10-08 19:07:56,246[39m[38;5;188m [39m[38;5;107mINFO [39m[38;5;188m [[39m[38;5;69morg.mon.dri.cluster[39m[38;5;188m] ([39m[38;5;71mcluster-ClusterId{value='6160970c21ccfd22aca10619', description='null'}-127.0.0.1:27017[39m[38;5;188m) [39m[38;5;151mException in monitor thread while connecting to server 127.0.0.1:27017[39m[38;5;203m: com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.internal.connection.AsynchronousSocketChannelStream$OpenCompletionHandler.failed(AsynchronousSocketChannelStream.java:124) at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129) at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:283) at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198) at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213) at
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939052651 The [MongoClient does seem to have been refactored](https://stackoverflow.com/questions/60267087/differences-between-com-mongodb-client-mongoclient-and-com-mongodb-mongoclient), and it seems I should be referencing `com.mongodb.client.MongoClient` instead of `com.mongodb.MongoClient`, where the former is an interface. So probably I should [configure a singleton bean by its type](https://camel.apache.org/components/latest/others/main.html#_configuring_singleton_beans_by_their_type), like so?: ``` camel.beans.mongoBean = #type:com.mongodb.client.MongoClient ``` But how to add an instance of that type to the Camel context? - there is the factory-like method `com.mongodb.client.MongoClients.create(String connectionString)` - I say "-like" because it doesn't return it's own type, but rather `com.mongodb.client.MongoClient`, so placing this in properties doesn't work: ``` camel.beans.mongoClient = #class:com.mongodb.client.MongoClients#create("...connection string...") ``` - How can I combine the output of `#class:com.mongodb.client.MongoClients#create` with `#type:com.mongodb.client.MongoClient` ? ...or how could I utilise the [custom bean](https://github.com/apache/camel-kamelets/blob/790b6b93975a3d73fb6f8d2396c7aca72ef50766/mongodb-source.kamelet.yaml#L69) mentioned? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939046355 It is indeed weird (I've been fighting this for two days). Ignoring the kamelets for now, if I reference the bean @heiko-braun mentioned in properties, like: ``` camel.beans.mongoBean = #class:org.apache.camel.component.mongodb.MongoDbComponent ``` then there is still the `127.0.0.1:27017` error. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-939039167 I tried the sink kamelet and it's pod logs also show the same error, on not being able to connect to `127.0.0.1:27017`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] bthj commented on issue #2684: Unable to access MongoDB
bthj commented on issue #2684: URL: https://github.com/apache/camel-k/issues/2684#issuecomment-938925359 I tried to use `.bean`, like so: ``` .bean(MongoDbComponent.class, "createEndpoint(String 'hosts=[shard1].mongodb.net:27017,[shard2].xiqat.mongodb.net:27017,[shard3].mongodb.net:27017=[user]=[pass]=[db]=[coll]=getDbStats')") ``` but that throws: ``` org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous method invocations possible: [protected org.apache.camel.Endpoint org.apache.camel.component.mongodb.MongoDbComponent.createEndpoint(java.lang.String,java.lang.String,java.util.Map) throws java.lang.Exception] on the exchange: Exchange[] ``` while I thought I was eliminating ambiguity by [using the type qualifier](https://camel.apache.org/manual/latest/bean-binding.html#BeanBinding-Usingtypequalifierstoselectamongoverloadedmethods) `String` to select among the overloaded methods. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org