Skip to content

Commit 70d09cb

Browse files
committed
Improve documentation of generated classes.
Motivation: - Improve documentation to include references for idiomatic gRPC/IO client and server APIs. - Provide clear comparisons between high-level and low-level APIs for clarity. Changes: - Updated `ioclient.adoc` and `ioserver.adoc` with new sections for idiomatic gRPC/IO APIs. - Added detailed descriptions and tables in `plugin.adoc` to explain generated RPC files and their purposes. - Added anchors for client and server request/response API sections (`client-request-response-api`, `server-request-response-api`).
1 parent 0b0fa82 commit 70d09cb

5 files changed

Lines changed: 42 additions & 6 deletions

File tree

vertx-grpc-docs/src/main/asciidoc/client.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ Flowable<String> responseStream = client
199199

200200
NOTE: this requires RxJava version of GrpcClient
201201

202+
[[client-request-response-api]]
202203
=== Client request/response API
203204

204205
The gRPC request/response client API provides an alternative way to interact with a server without the need of a generated stub.

vertx-grpc-docs/src/main/asciidoc/ioclient.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Deadline are cascaded, e.g. when the current `io.grpc.Context` carries a deadlin
5151
set, the client automatically inherits the implicit deadline. Such deadline can be set when using a stub within a gRPC server
5252
call.
5353

54+
[[idiomatic-client-io]]
5455
=== Idiomatic gRPC/IO client
5556

5657
The <<vertx-grpc-protoc-plugin,Vert.x gRPC protoc plugin>> supports the generation of gRPC/IO client code:

vertx-grpc-docs/src/main/asciidoc/ioserver.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The Vert.x gRPC Server can bridge a gRPC service to use with _grpc-java_ generat
4242

4343
The bridge supports deadline automatic cancellation: when a gRPC request carrying a timeout is received, a deadline is associated with the `io.grpc.Context` an can be obtained from the current context. This deadline automatically cancels the request in progress when its associated timeout fires.
4444

45+
[[idiomatic-server-io]]
4546
=== Idiomatic gRPC/IO service
4647

4748
The <<vertx-grpc-protoc-plugin,Vert.x gRPC protoc plugin>> supports the generation of gRPC/IO client code:

vertx-grpc-docs/src/main/asciidoc/plugin.adoc

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,42 @@ NOTE: the generator plugin is tech preview and can be subject to changes
213213

214214
=== Generated RPC files
215215

216-
For each service definition, the plugin creates several Java RPC files, let's have a quick look at them:
216+
For each service definition (e.g., `Greeter`), the plugin creates several Java RPC files with specific purposes:
217217

218-
- `examples/Greeter.java`
219-
- `examples/GreeterClient.java`
220-
- `examples/GreeterService.java`
221-
- `examples/GreeterGrpcClient.java`
222-
- `examples/GreeterGrpcService.java`
218+
[cols="2,4,1", options="header"]
219+
|===
220+
|Generated File |Description |Details
221+
222+
|`Greeter.java`
223+
|Base interface defining the service contract with all RPC methods declared as abstract methods
224+
|Common to both client and server
225+
226+
|`GreeterClient.java`
227+
|High-level client interface with idiomatic Vert.x Future-based methods for calling the service
228+
|<<idiomatic-client,Client API>>
229+
230+
|`GreeterService.java`
231+
|High-level server interface for implementing the service with idiomatic Vert.x Future-based handlers
232+
|<<idiomatic-server,Server Stub>>
233+
234+
|`GreeterGrpcClient.java`
235+
|Low-level client implementation providing direct access to gRPC request/response streams
236+
|<<client-request-response-api,Client Request/Response API>>
237+
238+
|`GreeterGrpcService.java`
239+
|Low-level server implementation providing direct access to gRPC request/response streams for handling
240+
|<<server-request-response-api,Server Request/Response API>>
241+
|===
242+
243+
NOTE: The `GreeterGrpcClient` and `GreeterGrpcService` classes provide lower-level APIs that give you more control over streaming and flow control, while `GreeterClient` and `GreeterService` provide higher-level, more idiomatic Vert.x APIs that are easier to use for most cases.
244+
245+
Additionally, when `grpc-io=true` is enabled, the plugin generates:
246+
247+
[cols="2,4,1", options="header"]
248+
|===
249+
|Generated File |Description |Details
250+
251+
|`GreeterGrpcIo.java`
252+
|Compatibility layer for using the service with standard `io.grpc` stubs and existing gRPC/IO ecosystem
253+
|<<idiomatic-server-io,gRPC/IO Server>> / <<idiomatic-client-io,gRPC/IO Client>>
254+
|===

vertx-grpc-docs/src/main/asciidoc/server.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ or you can process a `WriteStream`:
155155
{@link examples.GrpcServerExamples#streamingResponseStub2}
156156
----
157157

158+
[[server-request-response-api]]
158159
=== Server request/response API
159160

160161
The gRPC request/response server API provides an alternative way to interact with a client without the need of extending

0 commit comments

Comments
 (0)