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 2021/06/29 13:59:13 UTC

[GitHub] [camel-quarkus] JiriOndrusek opened a new pull request #2859: working

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


   fixes  https://github.com/apache/camel-quarkus/issues/2651
   supersedes https://github.com/apache/camel-quarkus/pull/2845
   
   Adds support of new SPI - https://github.com/apache/camel/pull/5714
   
   This enhancement uses vertx for the http server. Servers are started for required ports ad are managed via quarkus.
   Tests are still using jetty http server - but only in scope test.
   
   Unfortunatelly there is no public access to these methods (which have to be used in http server) - [HttpTranscier#readBuffers](https://github.com/justinsb/avro/blob/master/src/java/org/apache/avro/ipc/HttpTransceiver.java#L73), [HttpTransciever#writeBuffers](https://github.com/justinsb/avro/blob/master/src/java/org/apache/avro/ipc/HttpTransceiver.java#L94) and [HttpTransciever#writeLength](https://github.com/justinsb/avro/blob/master/src/java/org/apache/avro/ipc/HttpTransceiver.java#L104). For that reason, vertx request handler has to leverage [RespondServlet](https://github.com/justinsb/avro/blob/master/src/java/org/apache/avro/ipc/ResponderServlet.java), which requires creation of very simple `HttpServletRequest` and `HttpServletResponse`, which basically wraps `byte[]`.
   It makes sense to ask whether it is possible to make these methods public (or for example through creations of class called VertxResponder). If yes, `VertxHttpServer.java ` could be simplified - but that would be covered by follow-up issue.
   
   @ppalaga It seems, that we don't need to use any blocking feature of vertx here, camel component waits for the response of the server. But there is a small issue here. Vertx logs warnings if thread is blocked for more than 2000 ms. I'm not sure whether this could affect users. (but it doesn't affect the functionality) WDYT?
   
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] 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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: extensions/avro-rpc/runtime/src/main/java/org/apache/camel/quarkus/component/avro/rpc/spi/HttpServletResponseWithBytes.java
##########
@@ -0,0 +1,252 @@
+/*
+ * 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.avro.rpc.spi;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Empty implementation of {@link javax.servlet.http.HttpServletResponse}.
+ * Serves as a wrapper to be used for {@link org.apache.avro.ipc.ResponderServlet}.
+ */
+public class HttpServletResponseWithBytes implements HttpServletResponse {
+
+    private ServletOutputStreamWithBytes baos = new ServletOutputStreamWithBytes();
+
+    public byte[] getBytes() {
+        return baos.getBytes();
+    }
+
+    @Override
+    public ServletOutputStream getOutputStream() throws IOException {
+        return baos;
+    }
+
+    @Override
+    public void addCookie(Cookie cookie) {
+
+    }
+
+    // --------------------- following methods are not implemented and not used ----------------------------
+
+    @Override
+    public boolean containsHeader(String s) {
+        return false;

Review comment:
       Yes this would be better.




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



[GitHub] [camel-quarkus] ppalaga merged pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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


   


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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #2859:
URL: https://github.com/apache/camel-quarkus/pull/2859#issuecomment-871366732


   Follow-up issue https://github.com/apache/camel-quarkus/issues/2861
   (in case that avro brings a better API for this case - https://issues.apache.org/jira/browse/AVRO-3166)


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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: extensions/avro-rpc/runtime/src/main/java/org/apache/camel/quarkus/component/avro/rpc/spi/VertxHttpServer.java
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.avro.rpc.spi;
+
+import io.quarkus.arc.Arc;
+import io.vertx.core.Vertx;
+import io.vertx.core.buffer.Buffer;
+import org.apache.avro.AvroRuntimeException;
+import org.apache.avro.ipc.Responder;
+import org.apache.avro.ipc.ResponderServlet;
+import org.apache.avro.ipc.Server;
+
+public class VertxHttpServer implements Server {
+
+    private int port;
+
+    private ResponderServlet responder;
+
+    public VertxHttpServer(Responder servletAvro, int port) throws Exception {
+        this.port = port;
+        this.responder = new ResponderServlet(servletAvro);
+    }
+
+    @Override
+    public int getPort() {
+        return port;
+    }
+
+    @Override
+    public void start() {
+        Vertx vertx = Arc.container().instance(Vertx.class).get();
+
+        vertx.createHttpServer().requestHandler(rc -> {
+            rc.bodyHandler(handler -> {
+                HttpServletRequestFromBytes req = new HttpServletRequestFromBytes(handler.getBytes(), rc.method().name());
+                HttpServletResponseWithBytes resp = new HttpServletResponseWithBytes();
+                vertx.executeBlocking(

Review comment:
       @ppalaga  I changed implementation to be blocking.




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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: extensions/avro-rpc/deployment/src/main/java/org/apache/camel/quarkus/component/avro/rpc/deployment/AvroRpcProcessor.java
##########
@@ -37,7 +41,8 @@ FeatureBuildItem feature() {
     }
 
     @BuildStep
-    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex) {
+    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex,
+            BuildProducer<ReflectiveClassBuildItem> reflectiveClassProducer) {

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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: extensions/avro-rpc/deployment/src/main/java/org/apache/camel/quarkus/component/avro/rpc/deployment/AvroRpcProcessor.java
##########
@@ -37,7 +41,8 @@ FeatureBuildItem feature() {
     }
 
     @BuildStep
-    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex) {
+    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex,
+            BuildProducer<ReflectiveClassBuildItem> reflectiveClassProducer) {

Review comment:
       I thought I removed it, so I'll do it again.




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



[GitHub] [camel-quarkus] jamesnetherton commented on pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on pull request #2859:
URL: https://github.com/apache/camel-quarkus/pull/2859#issuecomment-871172662


   > We never know whether the code in the route is or is not going to block
   
   Yeah - we had to deal with the same problem in the `platform-http` consumer. So we process the request on a separate thread with `vertx.executeBlocking`.


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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: extensions/avro-rpc/runtime/src/main/java/org/apache/camel/quarkus/component/avro/rpc/spi/VertxHttpServer.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.avro.rpc.spi;
+
+import io.quarkus.arc.Arc;
+import io.vertx.core.Vertx;
+import io.vertx.core.buffer.Buffer;
+import org.apache.avro.AvroRuntimeException;
+import org.apache.avro.ipc.Responder;
+import org.apache.avro.ipc.ResponderServlet;
+import org.apache.avro.ipc.Server;
+
+public class VertxHttpServer implements Server {
+
+    private int port;
+
+    private Responder responder;
+
+    public VertxHttpServer(Responder servletAvro, int port) {
+        this.port = port;
+        this.responder = servletAvro;
+    }
+
+    @Override
+    public int getPort() {
+        return port;
+    }
+
+    @Override
+    public void start() {
+        Vertx vertx = Arc.container().instance(Vertx.class).get();
+
+        vertx.createHttpServer().requestHandler(rc -> {
+            rc.bodyHandler(handler -> {
+                HttpServletRequestFromBytes req = new HttpServletRequestFromBytes(handler.getBytes(), rc.method().name());
+                HttpServletResponseWithBytes resp = new HttpServletResponseWithBytes();
+
+                try {
+                    new ResponderServlet(responder).service(req, resp);

Review comment:
       done

##########
File path: extensions/avro-rpc/runtime/src/main/java/org/apache/camel/quarkus/component/avro/rpc/spi/HttpServletResponseWithBytes.java
##########
@@ -0,0 +1,252 @@
+/*
+ * 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.avro.rpc.spi;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Empty implementation of {@link javax.servlet.http.HttpServletResponse}.
+ * Serves as a wrapper to be used for {@link org.apache.avro.ipc.ResponderServlet}.
+ */
+public class HttpServletResponseWithBytes implements HttpServletResponse {
+
+    private ServletOutputStreamWithBytes baos = new ServletOutputStreamWithBytes();
+
+    public byte[] getBytes() {
+        return baos.getBytes();
+    }
+
+    @Override
+    public ServletOutputStream getOutputStream() throws IOException {
+        return baos;
+    }
+
+    @Override
+    public void addCookie(Cookie cookie) {
+
+    }
+
+    // --------------------- following methods are not implemented and not used ----------------------------
+
+    @Override
+    public boolean containsHeader(String s) {
+        return false;

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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: integration-tests/avro-rpc/pom.xml
##########
@@ -66,6 +66,11 @@
             <artifactId>camel-quarkus-integration-test-support</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.avro</groupId>
+            <artifactId>avro-ipc-jetty</artifactId>
+            <scope>test</scope>
+        </dependency>

Review comment:
       @ppalaga Here is a jetty dependency for tests scope used by tests.




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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: extensions/avro-rpc/runtime/src/main/java/org/apache/camel/quarkus/component/avro/rpc/spi/VertxHttpServer.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.avro.rpc.spi;
+
+import io.quarkus.arc.Arc;
+import io.vertx.core.Vertx;
+import io.vertx.core.buffer.Buffer;
+import org.apache.avro.AvroRuntimeException;
+import org.apache.avro.ipc.Responder;
+import org.apache.avro.ipc.ResponderServlet;
+import org.apache.avro.ipc.Server;
+
+public class VertxHttpServer implements Server {
+
+    private int port;
+
+    private Responder responder;
+
+    public VertxHttpServer(Responder servletAvro, int port) {
+        this.port = port;
+        this.responder = servletAvro;
+    }
+
+    @Override
+    public int getPort() {
+        return port;
+    }
+
+    @Override
+    public void start() {
+        Vertx vertx = Arc.container().instance(Vertx.class).get();
+
+        vertx.createHttpServer().requestHandler(rc -> {
+            rc.bodyHandler(handler -> {
+                HttpServletRequestFromBytes req = new HttpServletRequestFromBytes(handler.getBytes(), rc.method().name());
+                HttpServletResponseWithBytes resp = new HttpServletResponseWithBytes();
+
+                try {
+                    new ResponderServlet(responder).service(req, resp);

Review comment:
       Makes sense, I'll do it.




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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #2859:
URL: https://github.com/apache/camel-quarkus/pull/2859#issuecomment-870696992


   @ppalaga  yes, you are right. I forgot that the current main already uses camel 3.11. I rebased PR.


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



[GitHub] [camel-quarkus] ppalaga commented on pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #2859:
URL: https://github.com/apache/camel-quarkus/pull/2859#issuecomment-870683131


   @JiriOndrusek is there any reason why this PR is against `camel-main`? Wouldn't `main` be fine too?


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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: extensions/avro-rpc/runtime/src/main/java/org/apache/camel/quarkus/component/avro/rpc/spi/VertxHttpServer.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.avro.rpc.spi;
+
+import io.quarkus.arc.Arc;
+import io.vertx.core.Vertx;
+import io.vertx.core.buffer.Buffer;
+import org.apache.avro.AvroRuntimeException;
+import org.apache.avro.ipc.Responder;
+import org.apache.avro.ipc.ResponderServlet;
+import org.apache.avro.ipc.Server;
+
+public class VertxHttpServer implements Server {
+
+    private int port;
+
+    private Responder responder;
+
+    public VertxHttpServer(Responder servletAvro, int port) {
+        this.port = port;
+        this.responder = servletAvro;
+    }
+
+    @Override
+    public int getPort() {
+        return port;
+    }
+
+    @Override
+    public void start() {
+        Vertx vertx = Arc.container().instance(Vertx.class).get();
+
+        vertx.createHttpServer().requestHandler(rc -> {
+            rc.bodyHandler(handler -> {
+                HttpServletRequestFromBytes req = new HttpServletRequestFromBytes(handler.getBytes(), rc.method().name());
+                HttpServletResponseWithBytes resp = new HttpServletResponseWithBytes();
+
+                try {
+                    new ResponderServlet(responder).service(req, resp);

Review comment:
       org.apache.avro.ipc.ResponderServlet should be stateless, so one instance per VertxHttpServer should be enough, no?

##########
File path: extensions/avro-rpc/runtime/src/main/java/org/apache/camel/quarkus/component/avro/rpc/spi/HttpServletResponseWithBytes.java
##########
@@ -0,0 +1,252 @@
+/*
+ * 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.avro.rpc.spi;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Empty implementation of {@link javax.servlet.http.HttpServletResponse}.
+ * Serves as a wrapper to be used for {@link org.apache.avro.ipc.ResponderServlet}.
+ */
+public class HttpServletResponseWithBytes implements HttpServletResponse {
+
+    private ServletOutputStreamWithBytes baos = new ServletOutputStreamWithBytes();
+
+    public byte[] getBytes() {
+        return baos.getBytes();
+    }
+
+    @Override
+    public ServletOutputStream getOutputStream() throws IOException {
+        return baos;
+    }
+
+    @Override
+    public void addCookie(Cookie cookie) {
+
+    }
+
+    // --------------------- following methods are not implemented and not used ----------------------------
+
+    @Override
+    public boolean containsHeader(String s) {
+        return false;

Review comment:
       Maybe better throw an UnsupportedOperationException here and below?

##########
File path: extensions/avro-rpc/deployment/src/main/java/org/apache/camel/quarkus/component/avro/rpc/deployment/AvroRpcProcessor.java
##########
@@ -37,7 +41,8 @@ FeatureBuildItem feature() {
     }
 
     @BuildStep
-    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex) {
+    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex,
+            BuildProducer<ReflectiveClassBuildItem> reflectiveClassProducer) {

Review comment:
       reflectiveClassProducer does not seem to be used




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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2859: Class loader issues in AvroRpcTest with Quarkus 2.0.0.Alpha3 #2651

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



##########
File path: integration-tests/avro-rpc/pom.xml
##########
@@ -66,6 +66,11 @@
             <artifactId>camel-quarkus-integration-test-support</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.avro</groupId>
+            <artifactId>avro-ipc-jetty</artifactId>
+            <scope>test</scope>
+        </dependency>

Review comment:
       I am blind, sorry.




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