1 Star 0 Fork 1

寒松/camel-spring-boot-examples2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.adoc 4.46 KB
一键复制 编辑 原始数据 按行查看 历史

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:

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.

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

If you hit any problem using Camel or have some feedback, then please let us know.

We also love contributors, so get involved :-)

The Camel riders!

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qqzahng/camel-spring-boot-examples2.git
git@gitee.com:qqzahng/camel-spring-boot-examples2.git
qqzahng
camel-spring-boot-examples2
camel-spring-boot-examples2
camel-3.4.x

搜索帮助

0d507c66 1850385 C8b1a773 1850385