-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e53415
commit 0ff98ca
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
= Designing gRPC Endpoints | ||
|
||
include::ROOT:partial$include.adoc[] | ||
|
||
gRPC Endpoint components make it possible to conveniently define public APIs accepting and responding in protobuf, | ||
a binary, typed protocol which is designed to handle evolution of a service over time. | ||
|
||
== Basics == | ||
To define a gRPC Endpoint component, you start by defining a `.proto` file that defines the service and its messages | ||
in `src/main/proto` of the project. | ||
|
||
[source,protobuf] | ||
.{sample-base-url}/doc-snippets/src/main/proto/com/example/example_grpc_endpoint.proto | ||
---- | ||
include::example$doc-snippets/src/main/proto/com/example/example_grpc_endpoint.proto[] | ||
---- | ||
|
||
When compiling the project a Java interface for the service is generated `com.example.proto.ExampleGrpcEndpoint`. Define a class implementing this interface in the `api` package of your project | ||
and annotate the class with `@GrpcEndpoint`: | ||
|
||
[source,java] | ||
.{sample-base-url}/doc-snippets/src/main/java/ | ||
---- | ||
include::example$doc-snippets/src/main/java/com/example/api/ExampleGrpcEndpointImpl.java[] | ||
---- | ||
|
||
|