Here you will find examples demonstrating Vert.x gRPC in action.
To use Vert.x gRPC in your own Maven or Gradle project add the following dependency
Group ID: io.vertx Artifact ID: vertx-grpc
You will need to use the com.google.protobuf
plugin to compile the .proto
files.
These examples use the io.vertx:protoc-gen-grpc-java
plugin that creates
server and stub classes for Vert.x, this plugin is an extension of the
io.grpc:protoc-gen-grpc-java
plugin.
The protobuf compiler is available for Maven or Gradle and is OS dependant.
This example show how to handle RPC calls that send a single object and receive a single object.
This example show how to handle RPC calls that do receive an arbitrary stream of response objects.
This example show how to handle RPC calls that do sends an arbitrary stream of request objects.
This example shows how to handle arbitrary streams of request and response objects.
This example is adapted from the gRPC examples.
It shows a simple gRPC service that invokes a service that
takes takes an HelloRequest
string wrapper and returns an HelloReply
string wrapper.
The gRPC service extends the GreeterGrpc.GreeterVertxImplBase
generated class and
implements the service logic.
The gRPC client creates an instance of the GreeterGrpc.newVertxStub
generated class and
then use it to invoke the service.
You can run the server and then run the client.
You can read more about it on the gRPC website
This example is the Hello World example with SSL configuration.
It shows a simple gRPC service that invokes a service that
takes takes an HelloRequest
string wrapper and returns an HelloReply
string wrapper. The communication uses SSL.
The gRPC service extends the GreeterGrpc.GreeterVertxImplBase
generated class and
implements the service logic.
The gRPC client creates an instance of the GreeterGrpc.newVertxStub
generated class and
then use it to invoke the service.
You can run the server and then run the client.
This example is adapted from the gRPC examples.
This example shows the various kind of gRPC service calls:
simple RPC
server-side streaming RPC
client-side streaming RPC
bidirectional streaming RPC
You can run the server and then run the client.
You can read more about it on the gRPC website
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。