You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/10/12 11:58:43 UTC

[GitHub] [camel-quarkus] zbendhiba opened a new pull request #1905: PostgresSQL Event native support fixes #1719

zbendhiba opened a new pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905


   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503770861



##########
File path: integration-tests/pgevent/src/main/java/org/apache/camel/quarkus/component/pgevent/it/PgeventRoutes.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.it;
+
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+public class PgeventRoutes extends RouteBuilder {
+    @ConfigProperty(name = "database.host")
+    String host;
+    @ConfigProperty(name = "database.port")
+    Integer port;
+    @ConfigProperty(name = "database.name")
+    String databaseName;
+    @ConfigProperty(name = "database.user")
+    String user;
+    @ConfigProperty(name = "database.password")
+    String password;
+
+    @Override
+    public void configure() throws Exception {
+        // producer for simple pub-sub
+        from("direct:pgevent-pub")
+                .to("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}");
+
+        //consumer for simple pub-sub
+        from("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+
+        // producer with datasource
+        from("direct:pgevent-datasource")
+                .to("pgevent:///postgres/testchannel?datasource=#pgDataSource");
+
+        // consumer with datasource
+        from("pgevent:///postgres/testchannel?datasource=#pgDataSource")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+    }
+
+    @Produces
+    @Named("pgDataSource")
+    public PGDataSource loadDataSource() throws Exception {
+        PGDataSource dataSource = new PGDataSource();

Review comment:
       I've created the issue : https://github.com/apache/camel-quarkus/issues/1909, to follow up




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503358789



##########
File path: integration-tests/pgevent/src/main/java/org/apache/camel/quarkus/component/pgevent/it/PgeventRoutes.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.it;
+
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+public class PgeventRoutes extends RouteBuilder {
+    @ConfigProperty(name = "database.host")
+    String host;
+    @ConfigProperty(name = "database.port")
+    Integer port;
+    @ConfigProperty(name = "database.name")
+    String databaseName;
+    @ConfigProperty(name = "database.user")
+    String user;
+    @ConfigProperty(name = "database.password")
+    String password;
+
+    @Override
+    public void configure() throws Exception {
+        // producer for simple pub-sub
+        from("direct:pgevent-pub")
+                .to("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}");
+
+        //consumer for simple pub-sub
+        from("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+
+        // producer with datasource
+        from("direct:pgevent-datasource")
+                .to("pgevent:///postgres/testchannel?datasource=#pgDataSource");
+
+        // consumer with datasource
+        from("pgevent:///postgres/testchannel?datasource=#pgDataSource")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+    }
+
+    @Produces
+    @Named("pgDataSource")
+    public PGDataSource loadDataSource() throws Exception {
+        PGDataSource dataSource = new PGDataSource();

Review comment:
       @jamesnetherton yes, I've tested and it works fine. But in our camel component we get the connection from that datasource and if it's not an instance of PGConnection, we raise an error. 
   We need to handle a connection of type java.sql.Connection first here : https://github.com/apache/camel/blob/d23efa9cf87f6f5dab886206a3c00cc5e0e2472c/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventHelper.java#L35
   So maybe follow up an issue for an improvement.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503283303



##########
File path: integration-tests/pgevent/src/main/java/org/apache/camel/quarkus/component/pgevent/it/PgeventRoutes.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.it;
+
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+public class PgeventRoutes extends RouteBuilder {
+    @ConfigProperty(name = "database.host")
+    String host;
+    @ConfigProperty(name = "database.port")
+    Integer port;
+    @ConfigProperty(name = "database.name")
+    String databaseName;
+    @ConfigProperty(name = "database.user")
+    String user;
+    @ConfigProperty(name = "database.password")
+    String password;
+
+    @Override
+    public void configure() throws Exception {
+        // producer for simple pub-sub
+        from("direct:pgevent-pub")
+                .to("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}");
+
+        //consumer for simple pub-sub
+        from("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+
+        // producer with datasource
+        from("direct:pgevent-datasource")
+                .to("pgevent:///postgres/testchannel?datasource=#pgDataSource");
+
+        // consumer with datasource
+        from("pgevent:///postgres/testchannel?datasource=#pgDataSource")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+    }
+
+    @Produces
+    @Named("pgDataSource")
+    public PGDataSource loadDataSource() throws Exception {
+        PGDataSource dataSource = new PGDataSource();

Review comment:
       good point!!




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503353773



##########
File path: integration-tests/pgevent/src/main/java/org/apache/camel/quarkus/component/pgevent/it/PgeventRoutes.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.it;
+
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+public class PgeventRoutes extends RouteBuilder {
+    @ConfigProperty(name = "database.host")
+    String host;
+    @ConfigProperty(name = "database.port")
+    Integer port;
+    @ConfigProperty(name = "database.name")
+    String databaseName;
+    @ConfigProperty(name = "database.user")
+    String user;
+    @ConfigProperty(name = "database.password")
+    String password;
+
+    @Override
+    public void configure() throws Exception {
+        // producer for simple pub-sub
+        from("direct:pgevent-pub")
+                .to("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}");
+
+        //consumer for simple pub-sub
+        from("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+
+        // producer with datasource
+        from("direct:pgevent-datasource")
+                .to("pgevent:///postgres/testchannel?datasource=#pgDataSource");
+
+        // consumer with datasource
+        from("pgevent:///postgres/testchannel?datasource=#pgDataSource")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+    }
+
+    @Produces
+    @Named("pgDataSource")
+    public PGDataSource loadDataSource() throws Exception {
+        PGDataSource dataSource = new PGDataSource();

Review comment:
       Ok, maybe we merge the PR as-is and create a follow up issue to look into this afterwards.
   
   I think it should be possible to do. Both `PGDataSource` and `AgroalDatasource` extend `javax.sql.DataSource`. So doing `datasource=#nameOfTheAgroalDatasource` should work (in theory).




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503342338



##########
File path: integration-tests/pgevent/src/main/java/org/apache/camel/quarkus/component/pgevent/it/PgeventRoutes.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.it;
+
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+public class PgeventRoutes extends RouteBuilder {
+    @ConfigProperty(name = "database.host")
+    String host;
+    @ConfigProperty(name = "database.port")
+    Integer port;
+    @ConfigProperty(name = "database.name")
+    String databaseName;
+    @ConfigProperty(name = "database.user")
+    String user;
+    @ConfigProperty(name = "database.password")
+    String password;
+
+    @Override
+    public void configure() throws Exception {
+        // producer for simple pub-sub
+        from("direct:pgevent-pub")
+                .to("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}");
+
+        //consumer for simple pub-sub
+        from("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+
+        // producer with datasource
+        from("direct:pgevent-datasource")
+                .to("pgevent:///postgres/testchannel?datasource=#pgDataSource");
+
+        // consumer with datasource
+        from("pgevent:///postgres/testchannel?datasource=#pgDataSource")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+    }
+
+    @Produces
+    @Named("pgDataSource")
+    public PGDataSource loadDataSource() throws Exception {
+        PGDataSource dataSource = new PGDataSource();

Review comment:
       @jamesnetherton well it's not the same datasource. This is datasource expected is the one from pgevent API. The one having a connection that enables us to have those events.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga merged pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905


   


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503255949



##########
File path: extensions/pgevent/deployment/src/main/java/org/apache/camel/quarkus/component/pgevent/deployment/PgeventProcessor.java
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.deployment;
+
+import java.io.IOException;
+import java.sql.Driver;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import com.impossibl.postgres.system.procs.ProcProvider;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.util.ServiceUtil;
+import org.jboss.logging.Logger;
+
+class PgeventProcessor {
+
+    private static final String PGEVENT_SERVICE_BASE = "META-INF/services/";
+
+    private static final Logger LOG = Logger.getLogger(PgeventProcessor.class);

Review comment:
       I think this leftover can be removed.

##########
File path: integration-tests/pgevent/src/main/java/org/apache/camel/quarkus/component/pgevent/it/PgeventRoutes.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.it;
+
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+public class PgeventRoutes extends RouteBuilder {
+    @ConfigProperty(name = "database.host")
+    String host;
+    @ConfigProperty(name = "database.port")
+    Integer port;
+    @ConfigProperty(name = "database.name")
+    String databaseName;
+    @ConfigProperty(name = "database.user")
+    String user;
+    @ConfigProperty(name = "database.password")
+    String password;
+
+    @Override
+    public void configure() throws Exception {
+        // producer for simple pub-sub
+        from("direct:pgevent-pub")
+                .to("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}");
+
+        //consumer for simple pub-sub
+        from("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+
+        // producer with datasource
+        from("direct:pgevent-datasource")
+                .to("pgevent:///postgres/testchannel?datasource=#pgDataSource");
+
+        // consumer with datasource
+        from("pgevent:///postgres/testchannel?datasource=#pgDataSource")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+    }
+
+    @Produces
+    @Named("pgDataSource")
+    public PGDataSource loadDataSource() throws Exception {
+        PGDataSource dataSource = new PGDataSource();

Review comment:
       Maybe it'd be good to leverage the [Quarkus agroal](https://quarkus.io/guides/datasource) extension to create a named postgresql datasource? Or at least add another route / test case for that scenario. It's a good way of proving our stuff integrates well with Quarkus.
   

##########
File path: extensions/pgevent/deployment/src/main/java/org/apache/camel/quarkus/component/pgevent/deployment/PgeventProcessor.java
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.deployment;
+
+import java.io.IOException;
+import java.sql.Driver;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import com.impossibl.postgres.system.procs.ProcProvider;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.util.ServiceUtil;
+import org.jboss.logging.Logger;
+
+class PgeventProcessor {
+
+    private static final String PGEVENT_SERVICE_BASE = "META-INF/services/";
+
+    private static final Logger LOG = Logger.getLogger(PgeventProcessor.class);
+    private static final String FEATURE = "camel-pgevent";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    List<ReflectiveClassBuildItem> registerReflectiveClasses() {

Review comment:
       If there's just one `ReflectiveClassBuildItem` to return then I guess we don't need a `List`.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503351263



##########
File path: extensions/pgevent/deployment/src/main/java/org/apache/camel/quarkus/component/pgevent/deployment/PgeventProcessor.java
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.deployment;
+
+import java.io.IOException;
+import java.sql.Driver;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import com.impossibl.postgres.system.procs.ProcProvider;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.util.ServiceUtil;
+import org.jboss.logging.Logger;
+
+class PgeventProcessor {
+
+    private static final String PGEVENT_SERVICE_BASE = "META-INF/services/";
+
+    private static final Logger LOG = Logger.getLogger(PgeventProcessor.class);

Review comment:
       done

##########
File path: extensions/pgevent/deployment/src/main/java/org/apache/camel/quarkus/component/pgevent/deployment/PgeventProcessor.java
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.deployment;
+
+import java.io.IOException;
+import java.sql.Driver;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import com.impossibl.postgres.system.procs.ProcProvider;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.util.ServiceUtil;
+import org.jboss.logging.Logger;
+
+class PgeventProcessor {
+
+    private static final String PGEVENT_SERVICE_BASE = "META-INF/services/";
+
+    private static final Logger LOG = Logger.getLogger(PgeventProcessor.class);
+    private static final String FEATURE = "camel-pgevent";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    List<ReflectiveClassBuildItem> registerReflectiveClasses() {

Review comment:
       done




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1905: PostgresSQL Event native support fixes #1719

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1905:
URL: https://github.com/apache/camel-quarkus/pull/1905#discussion_r503343820



##########
File path: integration-tests/pgevent/src/main/java/org/apache/camel/quarkus/component/pgevent/it/PgeventRoutes.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.camel.quarkus.component.pgevent.it;
+
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+public class PgeventRoutes extends RouteBuilder {
+    @ConfigProperty(name = "database.host")
+    String host;
+    @ConfigProperty(name = "database.port")
+    Integer port;
+    @ConfigProperty(name = "database.name")
+    String databaseName;
+    @ConfigProperty(name = "database.user")
+    String user;
+    @ConfigProperty(name = "database.password")
+    String password;
+
+    @Override
+    public void configure() throws Exception {
+        // producer for simple pub-sub
+        from("direct:pgevent-pub")
+                .to("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}");
+
+        //consumer for simple pub-sub
+        from("pgevent://{{database.host}}:{{database.port}}/{{database.name}}/testchannel?user={{database.user}}&pass={{database.password}}")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+
+        // producer with datasource
+        from("direct:pgevent-datasource")
+                .to("pgevent:///postgres/testchannel?datasource=#pgDataSource");
+
+        // consumer with datasource
+        from("pgevent:///postgres/testchannel?datasource=#pgDataSource")
+                .log("Message got ${body}")
+                .bean(MyBean.class);
+    }
+
+    @Produces
+    @Named("pgDataSource")
+    public PGDataSource loadDataSource() throws Exception {
+        PGDataSource dataSource = new PGDataSource();

Review comment:
       if we want to have the agroal datasource, we need to convert this one to com.impossibl.postgres.jdbc.PGDatasource




----------------------------------------------------------------
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.

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