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/11/25 07:48:58 UTC

[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #2025: Camel Avro RPC component native support #1941

JiriOndrusek commented on a change in pull request #2025:
URL: https://github.com/apache/camel-quarkus/pull/2025#discussion_r530165431



##########
File path: integration-tests/avro-rpc/src/main/java/org/apache/camel/quarkus/component/avro/rpc/it/AvroRpcResource.java
##########
@@ -0,0 +1,139 @@
+/*
+ * 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.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.quarkus.component.avro.rpc.it.reflection.TestPojo;
+import org.apache.camel.quarkus.component.avro.rpc.it.reflection.TestReflection;
+import org.apache.camel.quarkus.component.avro.rpc.it.reflection.impl.TestReflectionImpl;
+import org.apache.camel.quarkus.component.avro.rpc.it.specific.generated.Key;
+import org.apache.camel.quarkus.component.avro.rpc.it.specific.generated.KeyValueProtocol;
+import org.apache.camel.quarkus.component.avro.rpc.it.specific.generated.Value;
+import org.apache.camel.quarkus.component.avro.rpc.it.specific.impl.KeyValueProtocolImpl;
+
+@Path("/avro-rpc")
+@ApplicationScoped
+public class AvroRpcResource {
+
+    public static final String REFLECTIVE_HTTP_SERVER_PORT_PARAM = "camel.avro-rpc.test.reflective.httpServerReflection.port";
+    public static final String REFLECTIVE_NETTY_SERVER_PORT_PARAM = "camel.avro-rpc.test.reflective.nettyServerReflection.port";
+    public static final String SPECIFIC_HTTP_SERVER_PORT_PARAM = "camel.avro-rpc.test.generated.httpServerReflection.port";
+    public static final String SPECIFIC_NETTY_SERVER_PORT_PARAM = "camel.avro-rpc.test.generated.nettyServerReflection.port";
+    public static final String REFLECTIVE_HTTP_TRANSCEIVER_PORT_PARAM = "camel.avro-rpc.test.httpTransceiverReflection.port";
+    public static final String REFLECTIVE_NETTY_TRANSCEIVER_PORT_PARAM = "camel.avro-rpc.test.nettyTransceiverReflection.port";
+    public static final String SPECIFIC_HTTP_TRANSCEIVER_PORT_PARAM = "camel.avro-rpc.test.specific.httpTransceiverReflection.port";
+    public static final String SPECIFIC_NETTY_TRANSCEIVER_PORT_PARAM = "camel.avro-rpc.test.specific.nettyTransceiverReflection.port";
+
+    private TestReflection httpTestReflection = new TestReflectionImpl(),
+            nettyTestReflection = new TestReflectionImpl();
+    private KeyValueProtocol httpKeyValue = new KeyValueProtocolImpl(),
+            nettyKeyValue = new KeyValueProtocolImpl();
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/reflectionProducerSet")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    public void reflectionProducerSet(@QueryParam("protocol") ProtocolType protocol, String name) throws Exception {
+        Object[] request = { name };
+        producerTemplate.requestBody(String.format(
+                "avro:%s:localhost:{{%s}}/setName?protocolClassName=%s&singleParameter=true",

Review comment:
       @ppalaga I'm not sure, what do you mean.
   Here is endpoint form `AvroRpcResource.java`
   >String.format(
                   "avro:%s:localhost:{{%s}}/setName?protocolClassName=%s&singleParameter=true",
                   protocol,
                   protocol == ProtocolType.http ? REFLECTIVE_HTTP_SERVER_PORT_PARAM : REFLECTIVE_NETTY_SERVER_PORT_PARAM,
                   TestReflection.class.getCanonicalName())
   
   Here is a route definition from 'AvroRpcRouteBuilder'
   >from(String.format("avro:http:localhost:%d/setTestPojo?protocolClassName=%s&singleParameter=true", httpPort,
                   TestReflection.class.getCanonicalName()))
                           ....
   
   I don't see much difference here. May I ask you for more information?




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