You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2017/08/08 06:46:25 UTC

[1/3] camel git commit: CAMEL-11644 - Create a Camel-gRPC example

Repository: camel
Updated Branches:
  refs/heads/master 4dc3e7200 -> 1c79aefdd


CAMEL-11644 - Create a Camel-gRPC example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a7526e9b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a7526e9b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a7526e9b

Branch: refs/heads/master
Commit: a7526e9bdb5b9f1af33ffc141f820f2f051bc8b0
Parents: 4dc3e72
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Aug 8 08:10:33 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Aug 8 08:10:33 2017 +0200

----------------------------------------------------------------------
 .../camel-example-spring-boot-grpc/README.adoc  |  66 ++++++++++
 .../hello-camel-grpc-client/pom.xml             | 126 +++++++++++++++++++
 .../example/springboot/grpc/Application.java    |  34 +++++
 .../example/springboot/grpc/CamelGrpcRoute.java |  45 +++++++
 .../src/main/proto/hellocamel.proto             |  39 ++++++
 .../src/main/resources/application.properties   |  19 +++
 .../hello-camel-grpc-server/pom.xml             |  88 +++++++++++++
 .../camel/examples/grpc/HelloCamelServer.java   |  82 ++++++++++++
 .../src/main/proto/hellocamel.proto             |  39 ++++++
 examples/camel-example-spring-boot-grpc/pom.xml |  45 +++++++
 10 files changed, 583 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/README.adoc
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/README.adoc b/examples/camel-example-spring-boot-grpc/README.adoc
new file mode 100644
index 0000000..637d5b4
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/README.adoc
@@ -0,0 +1,66 @@
+# Spring Boot Example with gRPC
+
+### Introduction
+
+This example demonstrates how you can use Camel-gRPC Starter component. The example is composed of a standalone gRPC server and a Camel Spring-boot gRPC route acting as client.
+
+### Server
+
+You can build the server under the directory hello-camel-grpc-server with:
+
+    $ mvn clean install 
+
+and then run the server with
+
+    $ mvn exec:java
+
+You should see the following output:
+
+[source,bash]
+----
+Aug 08, 2017 8:00:00 AM org.apache.camel.examples.grpc.HelloCamelServer start
+INFO: Server started. I'm listening on 50051
+----
+
+### Run the client
+
+You can build the client example under the directory hello-camel-grpc-client with:
+
+    $ mvn clean install
+
+and then run the example with
+
+    $ mvn spring-boot:run
+
+And you should see this output in the console.
+
+[source,bash]
+----
+2017-08-08 08:01:14.530  INFO 7096 --- [           main] o.a.c.e.springboot.grpc.Application      : Starting Application on ghost with PID 7096 (/home/oscerd/workspace/apache-camel/camel/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/target/classes started by oscerd in /home/oscerd/workspace/apache-camel/camel/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client)
+2017-08-08 08:01:14.532  INFO 7096 --- [           main] o.a.c.e.springboot.grpc.Application      : No active profile set, falling back to default profiles: default
+2017-08-08 08:01:14.563  INFO 7096 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@540ff973: startup date [Tue Aug 08 08:01:14 CEST 2017]; root of context hierarchy
+2017-08-08 08:01:15.177  INFO 7096 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$78492c0f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
+2017-08-08 08:01:15.447  INFO 7096 --- [           main] o.a.c.i.converter.DefaultTypeConverter   : Type converters loaded (core: 192, classpath: 1)
+2017-08-08 08:01:15.844  INFO 7096 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
+2017-08-08 08:01:15.894  INFO 7096 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Loading additional Camel XML routes from: classpath:camel/*.xml
+2017-08-08 08:01:15.894  INFO 7096 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Loading additional Camel XML rests from: classpath:camel-rest/*.xml
+2017-08-08 08:01:15.895  INFO 7096 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Starting CamelMainRunController to ensure the main thread keeps running
+2017-08-08 08:01:15.898  INFO 7096 --- [inRunController] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.20.0-SNAPSHOT (CamelContext: gRPC) is starting
+2017-08-08 08:01:15.899  INFO 7096 --- [inRunController] o.a.c.m.ManagedManagementStrategy        : JMX is enabled
+2017-08-08 08:01:15.904  INFO 7096 --- [           main] o.a.c.e.springboot.grpc.Application      : Started Application in 1.897 seconds (JVM running for 7.75)
+2017-08-08 08:01:16.074  INFO 7096 --- [inRunController] o.a.camel.spring.SpringCamelContext      : StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
+2017-08-08 08:01:16.118  INFO 7096 --- [inRunController] o.a.camel.component.grpc.GrpcProducer    : Creating channel to the remote gRPC server localhost:50051
+2017-08-08 08:01:16.214  INFO 7096 --- [inRunController] o.a.camel.spring.SpringCamelContext      : Route: route1 started and consuming from: timer://foo?period=10000&repeatCount=1
+2017-08-08 08:01:16.216  INFO 7096 --- [inRunController] o.a.camel.spring.SpringCamelContext      : Total 1 routes, of which 1 are started.
+2017-08-08 08:01:16.216  INFO 7096 --- [inRunController] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.20.0-SNAPSHOT (CamelContext: gRPC) started in 0.319 seconds
+2017-08-08 08:01:17.534  INFO 7096 --- [2 - timer://foo] route1                                   : Received message: "Hello Camel"
+
+----
+
+### Help
+
+If you hit any problems please let us know on the http://camel.apache.org/discussion-forums.html[Camel Forums].
+
+Please help us make Apache Camel better - we appreciate any feedback you may have. Enjoy!
+
+The Camel riders!

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml
new file mode 100644
index 0000000..555e589
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml
@@ -0,0 +1,126 @@
+<?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.example</groupId>
+    <artifactId>examples</artifactId>
+    <version>2.20.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-hello-grpc-client</artifactId>
+  <name>Camel :: Example :: gRPC :: Hello Camel Client</name>
+  <description>An example showing the Camel Grpc component with Spring Boot</description>
+
+  <properties>
+    <category>Cloud</category>
+    <spring.boot-version>${spring-boot-version}</spring.boot-version>
+  </properties>
+
+  <!-- Spring-Boot and Camel BOM -->
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring.boot-version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <!-- Camel -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-grpc-starter</artifactId>
+    </dependency>
+
+    <!-- Test -->
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>kr.motd.maven</groupId>
+        <artifactId>os-maven-plugin</artifactId>
+        <version>1.5.0.Final</version>
+      </extension>
+    </extensions>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>${spring.boot-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.xolstice.maven.plugins</groupId>
+        <artifactId>protobuf-maven-plugin</artifactId>
+        <version>0.5.0</version>
+        <configuration>
+          <protocArtifact>com.google.protobuf:protoc:3.3.0:exe:${os.detected.classifier}</protocArtifact>
+          <pluginId>grpc-java</pluginId>
+          <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc-version}:exe:${os.detected.classifier}</pluginArtifact>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>compile</goal>
+              <goal>compile-custom</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/Application.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/Application.java b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/Application.java
new file mode 100644
index 0000000..5300c92
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/Application.java
@@ -0,0 +1,34 @@
+/**
+ * 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.example.springboot.grpc;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+// CHECKSTYLE:OFF
+@SpringBootApplication
+public class Application {
+
+    /**
+     * Main method to start the application.
+     */
+    public static void main(String[] args) {
+        SpringApplication.run(Application.class, args);
+    }
+
+}
+// CHECKSTYLE:ON

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/CamelGrpcRoute.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/CamelGrpcRoute.java b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/CamelGrpcRoute.java
new file mode 100644
index 0000000..784391a
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/java/org/apache/camel/example/springboot/grpc/CamelGrpcRoute.java
@@ -0,0 +1,45 @@
+/**
+ * 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.example.springboot.grpc;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.examples.CamelHelloRequest;
+import org.springframework.stereotype.Component;
+
+/**
+ * A simple Camel Grpc route example using Spring-boot
+ */
+@Component
+public class CamelGrpcRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+
+        CamelHelloRequest request = CamelHelloRequest.newBuilder().setName("Camel").build();
+        from("timer://foo?period=10000&repeatCount=1").process(new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody(request, CamelHelloRequest.class);
+
+            }
+        }).to("grpc://localhost:50051/org.apache.camel.examples.CamelHello?method=sayHelloToCamel&synchronous=true").log("Received ${body}");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/proto/hellocamel.proto
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/proto/hellocamel.proto b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/proto/hellocamel.proto
new file mode 100644
index 0000000..787ae12
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/proto/hellocamel.proto
@@ -0,0 +1,39 @@
+/**
+ * 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.examples";
+option java_outer_classname = "HelloCamelProto";
+
+package org.apache.camel.examples;
+
+// The camel hello service definition.
+service CamelHello {
+  // Sends a greeting
+  rpc SayHelloToCamel (CamelHelloRequest) returns (CamelHelloReply) {}
+}
+
+// The request message containing the user's name.
+message CamelHelloRequest {
+  string name = 1;
+}
+
+// The response message containing the greetings
+message CamelHelloReply {
+  string message = 1;
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/resources/application.properties b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/resources/application.properties
new file mode 100644
index 0000000..fbf3831
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/src/main/resources/application.properties
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+camel.springboot.name=gRPC
+camel.springboot.main-run-controller=true

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml
new file mode 100644
index 0000000..646755c
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml
@@ -0,0 +1,88 @@
+<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/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.camel.example</groupId>
+		<artifactId>camel-example-zipkin</artifactId>
+		<version>2.20.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>camel-example-hello-grpc-server</artifactId>
+	<name>Camel :: Example :: gRPC :: Hello Camel Server</name>
+	<description>An example showing a simple gRPC server</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>io.grpc</groupId>
+			<artifactId>grpc-netty</artifactId>
+			<version>${grpc-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>io.grpc</groupId>
+			<artifactId>grpc-protobuf</artifactId>
+			<version>${grpc-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>io.grpc</groupId>
+			<artifactId>grpc-stub</artifactId>
+			<version>${grpc-version}</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<extensions>
+			<extension>
+				<groupId>kr.motd.maven</groupId>
+				<artifactId>os-maven-plugin</artifactId>
+				<version>1.5.0.Final</version>
+			</extension>
+		</extensions>
+		<plugins>
+			<plugin>
+				<groupId>org.xolstice.maven.plugins</groupId>
+				<artifactId>protobuf-maven-plugin</artifactId>
+				<version>0.5.0</version>
+				<configuration>
+					<protocArtifact>com.google.protobuf:protoc:3.3.0:exe:${os.detected.classifier}</protocArtifact>
+					<pluginId>grpc-java</pluginId>
+					<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc-version}:exe:${os.detected.classifier}</pluginArtifact>
+				</configuration>
+				<executions>
+					<execution>
+						<goals>
+							<goal>compile</goal>
+							<goal>compile-custom</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-enforcer-plugin</artifactId>
+				<version>1.4.1</version>
+				<executions>
+					<execution>
+						<id>enforce</id>
+						<goals>
+							<goal>enforce</goal>
+						</goals>
+						<configuration>
+							<rules>
+								<requireUpperBoundDeps />
+							</rules>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>exec-maven-plugin</artifactId>
+				<version>${exec-maven-plugin-version}</version>
+				<configuration>
+					<mainClass>org.apache.camel.examples.grpc.HelloCamelServer</mainClass>
+					<includePluginDependencies>false</includePluginDependencies>
+				</configuration>
+			</plugin>
+
+		</plugins>
+	</build>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java
new file mode 100644
index 0000000..21ef8bf
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.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.examples.grpc;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import org.apache.camel.examples.CamelHelloGrpc;
+import org.apache.camel.examples.CamelHelloReply;
+import org.apache.camel.examples.CamelHelloRequest;
+
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+import io.grpc.stub.StreamObserver;
+
+/**
+ * Server that manages startup/shutdown of a server.
+ */
+public class HelloCamelServer {
+    private static final Logger logger = Logger.getLogger(HelloCamelServer.class.getName());
+
+    private Server server;
+
+    private void start() throws IOException {
+        /* The port on which the server should run */
+        int port = 50051;
+        server = ServerBuilder.forPort(port).addService(new HelloCamelImpl()).build().start();
+        logger.info("Server started. I'm listening on " + port);
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            @Override
+            public void run() {
+                HelloCamelServer.this.stop();
+            }
+        });
+    }
+
+    private void stop() {
+        if (server != null) {
+            server.shutdown();
+        }
+    }
+
+    private void blockUntilShutdown() throws InterruptedException {
+        if (server != null) {
+            server.awaitTermination();
+        }
+    }
+
+    /**
+     * Main needed to launch server from command line
+     */
+    public static void main(String[] args) throws IOException, InterruptedException {
+        final HelloCamelServer server = new HelloCamelServer();
+        server.start();
+        server.blockUntilShutdown();
+    }
+
+    static class HelloCamelImpl extends CamelHelloGrpc.CamelHelloImplBase {
+
+        @Override
+        public void sayHelloToCamel(CamelHelloRequest req, StreamObserver<CamelHelloReply> responseObserver) {
+            CamelHelloReply reply = CamelHelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
+            responseObserver.onNext(reply);
+            responseObserver.onCompleted();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/proto/hellocamel.proto
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/proto/hellocamel.proto b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/proto/hellocamel.proto
new file mode 100644
index 0000000..787ae12
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/proto/hellocamel.proto
@@ -0,0 +1,39 @@
+/**
+ * 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.examples";
+option java_outer_classname = "HelloCamelProto";
+
+package org.apache.camel.examples;
+
+// The camel hello service definition.
+service CamelHello {
+  // Sends a greeting
+  rpc SayHelloToCamel (CamelHelloRequest) returns (CamelHelloReply) {}
+}
+
+// The request message containing the user's name.
+message CamelHelloRequest {
+  string name = 1;
+}
+
+// The response message containing the greetings
+message CamelHelloReply {
+  string message = 1;
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/pom.xml b/examples/camel-example-spring-boot-grpc/pom.xml
new file mode 100644
index 0000000..49583c1
--- /dev/null
+++ b/examples/camel-example-spring-boot-grpc/pom.xml
@@ -0,0 +1,45 @@
+<?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/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel.example</groupId>
+    <artifactId>examples</artifactId>
+    <version>2.20.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-spring-boot-grpc</artifactId>
+  <packaging>pom</packaging>
+  <name>Camel :: Example :: Spring Boot with gRPC</name>
+  <description>An example showing the Camel gRPC component with Spring Boot</description>
+
+  <properties>
+    <category>Cloud</category>
+  </properties>
+
+  <modules>
+    <module>hello-camel-grpc-server</module>
+    <module>hello-camel-grpc-client</module>
+  </modules>
+
+</project>


[3/3] camel git commit: CAMEL-11644 - Fixed CS

Posted by ac...@apache.org.
CAMEL-11644 - Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1c79aefd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1c79aefd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1c79aefd

Branch: refs/heads/master
Commit: 1c79aefddac9c5d469247ed9559ef59283e0cb86
Parents: 5cc09fa
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Aug 8 08:32:50 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Aug 8 08:32:58 2017 +0200

----------------------------------------------------------------------
 .../apache/camel/examples/grpc/HelloCamelServer.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1c79aefd/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java
index 21ef8bf..68b851a 100644
--- a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java
+++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java
@@ -19,19 +19,19 @@ package org.apache.camel.examples.grpc;
 import java.io.IOException;
 import java.util.logging.Logger;
 
-import org.apache.camel.examples.CamelHelloGrpc;
-import org.apache.camel.examples.CamelHelloReply;
-import org.apache.camel.examples.CamelHelloRequest;
-
 import io.grpc.Server;
 import io.grpc.ServerBuilder;
 import io.grpc.stub.StreamObserver;
 
+import org.apache.camel.examples.CamelHelloGrpc;
+import org.apache.camel.examples.CamelHelloReply;
+import org.apache.camel.examples.CamelHelloRequest;
+
 /**
  * Server that manages startup/shutdown of a server.
  */
 public class HelloCamelServer {
-    private static final Logger logger = Logger.getLogger(HelloCamelServer.class.getName());
+    private static final Logger LOG = Logger.getLogger(HelloCamelServer.class.getName());
 
     private Server server;
 
@@ -39,7 +39,7 @@ public class HelloCamelServer {
         /* The port on which the server should run */
         int port = 50051;
         server = ServerBuilder.forPort(port).addService(new HelloCamelImpl()).build().start();
-        logger.info("Server started. I'm listening on " + port);
+        LOG.info("Server started. I'm listening on " + port);
         Runtime.getRuntime().addShutdownHook(new Thread() {
             @Override
             public void run() {


[2/3] camel git commit: CAMEL-11644 - Regen readme

Posted by ac...@apache.org.
CAMEL-11644 - Regen readme


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5cc09faa
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5cc09faa
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5cc09faa

Branch: refs/heads/master
Commit: 5cc09faa1751a29f021e4370b07b0aafda4cfb41
Parents: a7526e9
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Aug 8 08:28:34 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Aug 8 08:28:34 2017 +0200

----------------------------------------------------------------------
 examples/README.adoc | 4 +++-
 examples/pom.xml     | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5cc09faa/examples/README.adoc
----------------------------------------------------------------------
diff --git a/examples/README.adoc b/examples/README.adoc
index f302ed3..bb2568c 100644
--- a/examples/README.adoc
+++ b/examples/README.adoc
@@ -11,7 +11,7 @@ View the individual example READMEs for details.
 ### Examples
 
 // examples: START
-Number of Examples: 95 (8 deprecated)
+Number of Examples: 96 (8 deprecated)
 
 [width="100%",cols="4,2,4",options="header"]
 |=======================================================================
@@ -68,6 +68,8 @@ Number of Examples: 95 (8 deprecated)
 
 | link:camel-example-hazelcast-kubernetes/ReadMe.md[Hazelcast Kubernetes] (camel-example-hazelcast-kubernetes) | Cloud | An example with Camel and Hazelcast running on Kubernetes
 
+| link:camel-example-spring-boot-grpc/README.adoc[Spring Boot Grpc] (camel-example-spring-boot-grpc) | Cloud | An example showing the Camel gRPC component with Spring Boot
+
 | link:camel-example-spring-boot-infinispan/README.adoc[Spring Boot Infinispan] (camel-example-spring-boot-infinispan) | Cloud | An example showing the Camel Infinispan component with Spring Boot
 
 | link:camel-example-spring-boot-servicecall/README.adoc[Spring Boot Servicecall] (camel-example-spring-boot-servicecall) | Cloud | An example showing how to work with Camel ServiceCall EIP and Spring Boot

http://git-wip-us.apache.org/repos/asf/camel/blob/5cc09faa/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index aa99f0e..268733d 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -97,6 +97,7 @@
     <module>camel-example-spring-boot</module>
     <module>camel-example-spring-boot-activemq</module>
     <module>camel-example-spring-boot-geocoder</module>
+    <module>camel-example-spring-boot-grpc</module>
     <module>camel-example-spring-boot-infinispan</module>
     <module>camel-example-spring-boot-live-reload</module>
     <module>camel-example-spring-boot-metrics</module>