You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gansheer (via GitHub)" <gi...@apache.org> on 2023/10/13 14:18:45 UTC

[PR] feat(database): Add multiple datasources example [camel-k-examples]

gansheer opened a new pull request, #88:
URL: https://github.com/apache/camel-k-examples/pull/88

   (no comment)


-- 
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-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(database): Add multiple datasources example [camel-k-examples]

Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on code in PR #88:
URL: https://github.com/apache/camel-k-examples/pull/88#discussion_r1358367165


##########
generic-examples/databases/H2DBMultiDatasources.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// camel-k: language=java
+// camel-k: dependency=mvn:io.quarkus:quarkus-jdbc-h2
+// camel-k: build-property=quarkus.datasource.default.db-kind=h2
+// camel-k: property=quarkus.datasource.default.username=username-default
+// camel-k: property=quarkus.datasource.default.jdbc.url=jdbc:h2:mem:default
+// camel-k: build-property=quarkus.datasource.testing.db-kind=h2
+// camel-k: property=quarkus.datasource.testing.username=username-testing
+// camel-k: property=quarkus.datasource.testing.jdbc.url=jdbc:h2:mem:testing
+// camel-k: trait=camel.runtime-version=3.2.0
+
+import io.agroal.api.AgroalDataSource;
+import io.quarkus.agroal.DataSource;
+import org.apache.camel.builder.RouteBuilder;
+import jakarta.inject.Inject;
+
+public class H2DBMultiDatasources extends RouteBuilder {
+
+    @Inject
+    @DataSource("default")
+    AgroalDataSource dataSource1;

Review Comment:
   I just checked, and it is as you say they are not mandatory. I will remove them.



-- 
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-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(database): Add multiple datasources example [camel-k-examples]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #88:
URL: https://github.com/apache/camel-k-examples/pull/88#discussion_r1358345526


##########
generic-examples/databases/H2DBMultiDatasources.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// camel-k: language=java
+// camel-k: dependency=mvn:io.quarkus:quarkus-jdbc-h2
+// camel-k: build-property=quarkus.datasource.default.db-kind=h2
+// camel-k: property=quarkus.datasource.default.username=username-default
+// camel-k: property=quarkus.datasource.default.jdbc.url=jdbc:h2:mem:default
+// camel-k: build-property=quarkus.datasource.testing.db-kind=h2
+// camel-k: property=quarkus.datasource.testing.username=username-testing
+// camel-k: property=quarkus.datasource.testing.jdbc.url=jdbc:h2:mem:testing
+// camel-k: trait=camel.runtime-version=3.2.0
+
+import io.agroal.api.AgroalDataSource;
+import io.quarkus.agroal.DataSource;
+import org.apache.camel.builder.RouteBuilder;
+import jakarta.inject.Inject;
+
+public class H2DBMultiDatasources extends RouteBuilder {
+
+    @Inject
+    @DataSource("default")
+    AgroalDataSource dataSource1;

Review Comment:
   I was curious about having to inject the `DataSource`. Is it definitely required?
   
   I tested with a plain Camel Quarkus app earlier today and it was enough to just refer to the DS by name via the `dataSource` URI param.



-- 
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-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(database): Add multiple datasources example [camel-k-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #88:
URL: https://github.com/apache/camel-k-examples/pull/88#discussion_r1358367106


##########
generic-examples/databases/H2DBMultiDatasources.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// camel-k: language=java
+// camel-k: dependency=mvn:io.quarkus:quarkus-jdbc-h2
+// camel-k: build-property=quarkus.datasource.default.db-kind=h2
+// camel-k: property=quarkus.datasource.default.username=username-default
+// camel-k: property=quarkus.datasource.default.jdbc.url=jdbc:h2:mem:default
+// camel-k: build-property=quarkus.datasource.testing.db-kind=h2
+// camel-k: property=quarkus.datasource.testing.username=username-testing
+// camel-k: property=quarkus.datasource.testing.jdbc.url=jdbc:h2:mem:testing
+// camel-k: trait=camel.runtime-version=3.2.0
+
+import io.agroal.api.AgroalDataSource;
+import io.quarkus.agroal.DataSource;
+import org.apache.camel.builder.RouteBuilder;
+import jakarta.inject.Inject;
+
+public class H2DBMultiDatasources extends RouteBuilder {
+
+    @Inject
+    @DataSource("default")
+    AgroalDataSource dataSource1;

Review Comment:
   Yeah, I agree that there is no need to delcare the dataSource here.



-- 
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-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(database): Add multiple datasources example [camel-k-examples]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez merged PR #88:
URL: https://github.com/apache/camel-k-examples/pull/88


-- 
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-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org