Skip to content

Commit

Permalink
Basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
johanandren committed Jan 23, 2025
1 parent 7e53415 commit 0ff98ca
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/src/modules/java/pages/grpc-endpoints.adoc
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[]
----


0 comments on commit 0ff98ca

Please sign in to comment.