This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit cfec419cc2abc19e740e0581bb38291cffb8e97b
Author: Peter Palaga <ppal...@redhat.com>
AuthorDate: Wed Mar 25 14:19:35 2020 +0100

    Fix #965 gRPC support (JVM only)
---
 .../pages/list-of-camel-quarkus-extensions.adoc    |   6 +-
 extensions-jvm/grpc/deployment/pom.xml             |  75 ++++++++++++
 .../component/grpc/deployment/GrpcProcessor.java   |  46 +++++++
 extensions-jvm/grpc/integration-test/pom.xml       | 134 +++++++++++++++++++++
 .../quarkus/component/grpc/it/GrpcResource.java    |  54 +++++++++
 .../camel/quarkus/component/grpc/it/GrpcRoute.java |  37 ++++++
 .../quarkus/component/grpc/it/PingPongImpl.java    |  38 ++++++
 .../integration-test/src/main/proto/pingpong.proto |  50 ++++++++
 .../component/grpc/it/GrpcServerTestResource.java  |  57 +++++++++
 .../camel/quarkus/component/grpc/it/GrpcTest.java  |  77 ++++++++++++
 extensions-jvm/grpc/pom.xml                        |  40 ++++++
 extensions-jvm/grpc/runtime/pom.xml                |  83 +++++++++++++
 .../main/resources/META-INF/quarkus-extension.yaml |  28 +++++
 extensions-jvm/pom.xml                             |   1 +
 pom.xml                                            |   1 +
 poms/bom-deployment/pom.xml                        |   5 +
 poms/bom/pom.xml                                   |  10 ++
 17 files changed, 741 insertions(+), 1 deletion(-)

diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc 
b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index 5314620..b2c2c00 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list:
 == Camel Components
 
 // components: START
-Number of Camel components: 143 in 108 JAR artifacts (0 deprecated)
+Number of Camel components: 144 in 109 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,1,5",options="header"]
 |===
@@ -305,6 +305,10 @@ Level | Since | Description
 `graphql:httpUri` | Native +
  Stable | 1.0.0-M5 | A Camel GraphQL Component
 
+| link:https://camel.apache.org/components/latest/grpc-component.html[gRPC] 
(camel-quarkus-grpc) +
+`grpc:host:port/service` | JVM +
+ Preview | 1.0.0-M6 | The gRPC component allows to call and expose remote 
procedures via HTTP/2 with protobuf dataformat
+
 | xref:extensions/http.adoc[HTTP] (camel-quarkus-http) +
 `http:httpUri` | Native +
  Stable | 1.0.0-M3 | For calling out to external HTTP servers using Apache 
HTTP Client 4.x.
diff --git a/extensions-jvm/grpc/deployment/pom.xml 
b/extensions-jvm/grpc/deployment/pom.xml
new file mode 100644
index 0000000..9a465dc
--- /dev/null
+++ b/extensions-jvm/grpc/deployment/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-grpc-parent</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-grpc-deployment</artifactId>
+    <name>Camel Quarkus :: gRPC :: Deployment</name>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom-deployment</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core-deployment</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-grpc</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            
<artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git 
a/extensions-jvm/grpc/deployment/src/main/java/org/apache/camel/quarkus/component/grpc/deployment/GrpcProcessor.java
 
b/extensions-jvm/grpc/deployment/src/main/java/org/apache/camel/quarkus/component/grpc/deployment/GrpcProcessor.java
new file mode 100644
index 0000000..0e1b125
--- /dev/null
+++ 
b/extensions-jvm/grpc/deployment/src/main/java/org/apache/camel/quarkus/component/grpc/deployment/GrpcProcessor.java
@@ -0,0 +1,46 @@
+/*
+ * 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.grpc.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import org.apache.camel.quarkus.core.JvmOnlyRecorder;
+import org.jboss.logging.Logger;
+
+class GrpcProcessor {
+
+    private static final Logger LOG = Logger.getLogger(GrpcProcessor.class);
+    private static final String FEATURE = "camel-grpc";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    /**
+     * Remove this once this extension starts supporting the native mode.
+     */
+    @BuildStep(onlyIf = NativeBuild.class)
+    @Record(value = ExecutionTime.RUNTIME_INIT)
+    void warnJvmInNative(JvmOnlyRecorder recorder) {
+        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
+        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    }
+}
diff --git a/extensions-jvm/grpc/integration-test/pom.xml 
b/extensions-jvm/grpc/integration-test/pom.xml
new file mode 100644
index 0000000..36a9398
--- /dev/null
+++ b/extensions-jvm/grpc/integration-test/pom.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-grpc-parent</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-grpc-integration-test</artifactId>
+    <name>Camel Quarkus :: gRPC :: Integration Test</name>
+    <description>Integration tests for Camel Quarkus gRPC 
extension</description>
+
+    <properties>
+        <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
+        <!-- The following rule tells mvnd to build the listed deployment 
modules before this module. -->
+        <!-- This is important because mvnd builds modules in parallel by 
default. The deployment modules are not -->
+        <!-- explicit dependencies of this module in the Maven sense, although 
they are required by the Quarkus Maven plugin. -->
+        <!-- Please update rule whenever you change the dependencies of this 
module by running -->
+        <!--     mvn process-resources -Pformat    from the root directory -->
+        
<mvnd.builder.rule>camel-quarkus-grpc-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom-test</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-grpc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-integration-test-support</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>kr.motd.maven</groupId>
+                <artifactId>os-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>initialize</phase>
+                        <goals>
+                            <goal>detect</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.xolstice.maven.plugins</groupId>
+                <artifactId>protobuf-maven-plugin</artifactId>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>compile</goal>
+                            <goal>compile-custom</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
+                            <pluginId>grpc-java</pluginId>
+                            
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
+                            <checkStaleness>true</checkStaleness>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/GrpcResource.java
 
b/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/GrpcResource.java
new file mode 100644
index 0000000..38a4baa
--- /dev/null
+++ 
b/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/GrpcResource.java
@@ -0,0 +1,54 @@
+/*
+ * 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.grpc.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.grpc.it.model.PingRequest;
+import org.apache.camel.quarkus.component.grpc.it.model.PongResponse;
+
+@Path("/grpc")
+@ApplicationScoped
+public class GrpcResource {
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/producer")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String producer(String pingName, @QueryParam("pingId") int pingId) 
throws Exception {
+        final PingRequest pingRequest = PingRequest.newBuilder()
+                .setPingName(pingName)
+                .setPingId(pingId)
+                .build();
+        final PongResponse response = producerTemplate.requestBody(
+                
"grpc://localhost:{{camel.grpc.test.server.port}}/org.apache.camel.quarkus.component.grpc.it.model.PingPong?method=pingSyncSync&synchronous=true",
+                pingRequest, PongResponse.class);
+        return response.getPongName();
+    }
+
+}
diff --git 
a/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/GrpcRoute.java
 
b/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/GrpcRoute.java
new file mode 100644
index 0000000..fab0cb3
--- /dev/null
+++ 
b/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/GrpcRoute.java
@@ -0,0 +1,37 @@
+/*
+ * 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.grpc.it;
+
+import org.apache.camel.Message;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.quarkus.component.grpc.it.model.PingRequest;
+import org.apache.camel.quarkus.component.grpc.it.model.PongResponse;
+
+public class GrpcRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        
from("grpc://localhost:{{camel.grpc.consumer.port}}/org.apache.camel.quarkus.component.grpc.it.model.PingPong?synchronous=true")
+                .process(exchange -> {
+                    final Message message = exchange.getMessage();
+                    final PingRequest request = 
message.getBody(PingRequest.class);
+                    final PongResponse response = 
PongResponse.newBuilder().setPongName(request.getPingName() + " PONG")
+                            .setPongId(request.getPingId()).build();
+                    message.setBody(response);
+                });
+    }
+}
diff --git 
a/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/PingPongImpl.java
 
b/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/PingPongImpl.java
new file mode 100644
index 0000000..db153ca
--- /dev/null
+++ 
b/extensions-jvm/grpc/integration-test/src/main/java/org/apache/camel/quarkus/component/grpc/it/PingPongImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.grpc.it;
+
+import io.grpc.stub.StreamObserver;
+import org.apache.camel.quarkus.component.grpc.it.model.PingRequest;
+import org.apache.camel.quarkus.component.grpc.it.model.PongResponse;
+import org.jboss.logging.Logger;
+
+public class PingPongImpl extends 
org.apache.camel.quarkus.component.grpc.it.model.PingPongGrpc.PingPongImplBase {
+    private static final Logger LOG = Logger.getLogger(PingPongImpl.class);
+    static final String GRPC_TEST_PONG_VALUE = "PONG";
+
+    @Override
+    public void pingSyncSync(PingRequest request, StreamObserver<PongResponse> 
responseObserver) {
+        LOG.infof("gRPC server received data from PingPong service PingId=%s 
PingName=%s", request.getPingId(),
+                request.getPingName());
+        PongResponse response = 
PongResponse.newBuilder().setPongName(request.getPingName() + 
GRPC_TEST_PONG_VALUE)
+                .setPongId(request.getPingId()).build();
+        responseObserver.onNext(response);
+        responseObserver.onCompleted();
+    }
+
+}
diff --git a/extensions-jvm/grpc/integration-test/src/main/proto/pingpong.proto 
b/extensions-jvm/grpc/integration-test/src/main/proto/pingpong.proto
new file mode 100644
index 0000000..459a3b3
--- /dev/null
+++ b/extensions-jvm/grpc/integration-test/src/main/proto/pingpong.proto
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "org.apache.camel.quarkus.component.grpc.it.model";
+option java_outer_classname = "PingPongProto";
+
+package org.apache.camel.quarkus.component.grpc.it.model;
+
+// The PingPong service definition.
+service PingPong {
+  // Sending ping message and getting pong answer synchronously
+  rpc PingSyncSync (PingRequest) returns (PongResponse) {}
+
+  // Sending ping message synchronously and getting pong answer asynchronously 
in streaming mode (multiple response messages)
+  rpc PingSyncAsync (PingRequest) returns (stream PongResponse) {}
+
+  // Sending ping message asynchronously and getting pong answer synchronously
+  rpc PingAsyncSync (stream PingRequest) returns (PongResponse) {}
+
+  // Sending ping message asynchronously and getting pong answer 
asynchronously in streaming mode (multiple response messages)
+  rpc PingAsyncAsync (stream PingRequest) returns (stream PongResponse) {}
+}
+
+// The ping request message
+message PingRequest {
+  string ping_name = 1;
+  int32  ping_id   = 2;
+}
+
+// The pong response message
+message PongResponse {
+  string pong_name = 1;
+  int32  pong_id   = 2;
+}
\ No newline at end of file
diff --git 
a/extensions-jvm/grpc/integration-test/src/test/java/org/apache/camel/quarkus/component/grpc/it/GrpcServerTestResource.java
 
b/extensions-jvm/grpc/integration-test/src/test/java/org/apache/camel/quarkus/component/grpc/it/GrpcServerTestResource.java
new file mode 100644
index 0000000..c647fd2
--- /dev/null
+++ 
b/extensions-jvm/grpc/integration-test/src/test/java/org/apache/camel/quarkus/component/grpc/it/GrpcServerTestResource.java
@@ -0,0 +1,57 @@
+/*
+ * 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.grpc.it;
+
+import java.util.Map;
+
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import org.apache.camel.quarkus.test.AvailablePortFinder;
+import org.apache.camel.util.CollectionHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GrpcServerTestResource implements 
QuarkusTestResourceLifecycleManager {
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(GrpcServerTestResource.class);
+    private Server grpcServer;
+
+    @Override
+    public Map<String, String> start() {
+        try {
+            final int port = AvailablePortFinder.getNextAvailable();
+            grpcServer = ServerBuilder.forPort(port).addService(new 
PingPongImpl()).build().start();
+            return CollectionHelper.mapOf(
+                    "camel.grpc.test.server.port", String.valueOf(port),
+                    "camel.grpc.consumer.port", 
String.valueOf(AvailablePortFinder.getNextAvailable()));
+        } catch (Exception e) {
+            throw new RuntimeException("Could not start gRPC server", e);
+        }
+    }
+
+    @Override
+    public void stop() {
+        try {
+            if (grpcServer != null) {
+                grpcServer.shutdown();
+            }
+        } catch (Exception e) {
+            LOGGER.error("Could not stop gRPC server", e);
+        }
+    }
+}
diff --git 
a/extensions-jvm/grpc/integration-test/src/test/java/org/apache/camel/quarkus/component/grpc/it/GrpcTest.java
 
b/extensions-jvm/grpc/integration-test/src/test/java/org/apache/camel/quarkus/component/grpc/it/GrpcTest.java
new file mode 100644
index 0000000..ab5b708
--- /dev/null
+++ 
b/extensions-jvm/grpc/integration-test/src/test/java/org/apache/camel/quarkus/component/grpc/it/GrpcTest.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.
+ */
+package org.apache.camel.quarkus.component.grpc.it;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.quarkus.component.grpc.it.model.PingPongGrpc;
+import 
org.apache.camel.quarkus.component.grpc.it.model.PingPongGrpc.PingPongBlockingStub;
+import org.apache.camel.quarkus.component.grpc.it.model.PingRequest;
+import org.apache.camel.quarkus.component.grpc.it.model.PongResponse;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+
+@QuarkusTest
+@QuarkusTestResource(GrpcServerTestResource.class)
+class GrpcTest {
+
+    @ConfigProperty(name = "camel.grpc.consumer.port")
+    int consumerPort;
+
+    @Test
+    public void consumer() {
+        ManagedChannel syncRequestChannel = null;
+        try {
+            syncRequestChannel = ManagedChannelBuilder.forAddress("localhost", 
consumerPort).usePlaintext().build();
+            final PingPongBlockingStub blockingStub = 
PingPongGrpc.newBlockingStub(syncRequestChannel);
+
+            final PingRequest pingRequest = PingRequest.newBuilder()
+                    .setPingName("foo")
+                    .setPingId(567)
+                    .build();
+            final PongResponse pongResponse = 
blockingStub.pingSyncSync(pingRequest);
+            Assertions.assertNotNull(pongResponse);
+            Assertions.assertEquals(567, pongResponse.getPongId());
+            Assertions.assertEquals("foo PONG", pongResponse.getPongName());
+        } finally {
+            if (syncRequestChannel != null) {
+                syncRequestChannel.shutdownNow();
+            }
+        }
+    }
+
+    @Test
+    public void producer() {
+        int id = 1234;
+        RestAssured.given()
+                .contentType("text/plain")
+                .queryParam("pingId", id)
+                .body("PING")
+                .post("/grpc/producer")
+                .then()
+                .statusCode(200)
+                .body(equalTo("PINGPONG"));
+
+    }
+
+}
diff --git a/extensions-jvm/grpc/pom.xml b/extensions-jvm/grpc/pom.xml
new file mode 100644
index 0000000..279c83d
--- /dev/null
+++ b/extensions-jvm/grpc/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-build-parent</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-grpc-parent</artifactId>
+    <name>Camel Quarkus :: gRPC</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>deployment</module>
+        <module>runtime</module>
+        <module>integration-test</module>
+    </modules>
+</project>
diff --git a/extensions-jvm/grpc/runtime/pom.xml 
b/extensions-jvm/grpc/runtime/pom.xml
new file mode 100644
index 0000000..37f95c7
--- /dev/null
+++ b/extensions-jvm/grpc/runtime/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-grpc-parent</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-grpc</artifactId>
+    <name>Camel Quarkus :: gRPC :: Runtime</name>
+    <description>The gRPC component allows to call and expose remote 
procedures via HTTP/2 with protobuf dataformat</description>
+
+    <properties>
+        <firstVersion>1.0.0-M6</firstVersion>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-grpc</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            
<artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/extensions-jvm/grpc/runtime/src/main/resources/META-INF/quarkus-extension.yaml
 
b/extensions-jvm/grpc/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..b0a452b
--- /dev/null
+++ 
b/extensions-jvm/grpc/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+---
+name: "gRPC"
+description: "The gRPC component allows to call and expose remote procedures 
via HTTP/2 with protobuf dataformat"
+metadata:
+  unlisted: true
+  keywords:
+  - "rpc"
+  guide: "https://camel.apache.org/components/latest/grpc-component.html";
+  categories:
+  - "integration"
+  status: "preview"
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index 212a060..f0c16ed 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -60,6 +60,7 @@
         <module>elasticsearch-rest</module>
         <module>google-bigquery</module>
         <module>groovy</module>
+        <module>grpc</module>
         <module>influxdb</module>
         <module>kubernetes</module>
         <module>kudu</module>
diff --git a/pom.xml b/pom.xml
index 86dd028..86b2a96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,6 +49,7 @@
         <freemarker.version>2.3.30</freemarker.version>
         <google-http-client.version>1.22.0</google-http-client.version>
         <guava.version>26.0-jre</guava.version>
+        <grpc.version>1.27.0</grpc.version>
         <gson.version>2.8.5</gson.version>
         <hapi.version>4.1.0</hapi.version>
         <httpclient.cache.version>4.5.5</httpclient.cache.version>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index a716239..86b4f43 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -424,6 +424,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-grpc-deployment</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-gson-deployment</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index a3dfaf5..68a49b7 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -489,6 +489,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel</groupId>
+                <artifactId>camel-grpc</artifactId>
+                <version>${camel.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
                 <artifactId>camel-gson</artifactId>
                 <version>${camel.version}</version>
             </dependency>
@@ -1359,6 +1364,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-grpc</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-gson</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>

Reply via email to