mirror of https://github.com/grpc/grpc.io.git
Java QS and Tutorial cleanup (#108)
Mainly just markdown cleanup. Contributes to #87 and #88 for Java.
This commit is contained in:
parent
355070ca21
commit
79ee012593
|
|
@ -21,9 +21,9 @@ clones the entire repository, but you just need the examples for this quickstart
|
|||
and other tutorials):
|
||||
|
||||
```sh
|
||||
$ # Clone the repository at the latest release to get the example code:
|
||||
# Clone the repository at the latest release to get the example code:
|
||||
$ git clone -b {{< param grpc_java_release_tag >}} https://github.com/grpc/grpc-java
|
||||
$ # Navigate to the Java examples:
|
||||
# Navigate to the Java examples:
|
||||
$ cd grpc-java/examples
|
||||
```
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ server and the client "stub" have a `SayHello` RPC method that takes a
|
|||
server, and that this method is defined like this:
|
||||
|
||||
|
||||
```java
|
||||
```protobuf
|
||||
// The greeting service definition.
|
||||
service Greeter {
|
||||
// Sends a greeting
|
||||
|
|
@ -83,7 +83,7 @@ Let's update this so that the `Greeter` service has two methods. Edit
|
|||
`src/main/proto/helloworld.proto` and update it with a new `SayHelloAgain`
|
||||
method, with the same request and response types:
|
||||
|
||||
```java
|
||||
```protobuf
|
||||
// The greeting service definition.
|
||||
service Greeter {
|
||||
// Sends a greeting
|
||||
|
|
@ -138,7 +138,6 @@ private class GreeterImpl extends GreeterGrpc.GreeterImplBase {
|
|||
responseObserver.onCompleted();
|
||||
}
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
#### Update the client
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ define the gRPC *service* and the method *request* and *response* types using
|
|||
[protocol
|
||||
buffers](https://developers.google.com/protocol-buffers/docs/overview). You can
|
||||
see the complete .proto file in
|
||||
[`grpc-java/examples/src/main/proto/route_guide.proto`](https://github.com/grpc/grpc-java/blob/master/examples/src/main/proto/route_guide.proto).
|
||||
[grpc-java/examples/src/main/proto/route_guide.proto](https://github.com/grpc/grpc-java/blob/master/examples/src/main/proto/route_guide.proto).
|
||||
|
||||
As we're generating Java code in this example, we've specified a `java_package`
|
||||
file option in our .proto:
|
||||
|
|
@ -167,9 +167,8 @@ a special gRPC Java plugin. You need to use the
|
|||
both proto2 and proto3 syntax) in order to generate gRPC services.
|
||||
|
||||
When using Gradle or Maven, the protoc build plugin can generate the necessary
|
||||
code as part of the build. You can refer to the <a
|
||||
href="https://github.com/grpc/grpc-java/blob/master/README.md">README</a> for
|
||||
how to generate code from your own .proto files.
|
||||
code as part of the build. You can refer to the [grpc-java README][] for
|
||||
how to generate code from your own `.proto` files.
|
||||
|
||||
The following classes are generated from our service definition:
|
||||
|
||||
|
|
@ -300,6 +299,7 @@ RPC, we use the response observer's `onCompleted()` method to tell gRPC that
|
|||
we've finished writing responses.
|
||||
|
||||
##### Client-side streaming RPC
|
||||
|
||||
Now let's look at something a little more complicated: the client-side streaming
|
||||
method `RecordRoute`, where we get a stream of `Point`s from the client and
|
||||
return a single `RouteSummary` with information about their trip.
|
||||
|
|
@ -675,10 +675,10 @@ for our client-streaming method. Although each side will always get the other's
|
|||
messages in the order they were written, both the client and server can read and
|
||||
write in any order — the streams operate completely independently.
|
||||
|
||||
|
||||
### Try it out!
|
||||
|
||||
Follow the instructions in the example directory
|
||||
[README](https://github.com/grpc/grpc-java/blob/master/examples/README.md) to
|
||||
build and run the client and server.
|
||||
Follow the instructions in the [example directory README][] to build and run the
|
||||
client and server.
|
||||
|
||||
[example directory README]: https://github.com/grpc/grpc-java/blob/master/examples/README.md
|
||||
[grpc-java README]: https://github.com/grpc/grpc-java/blob/master/README.md
|
||||
|
|
|
|||
Loading…
Reference in New Issue