Merge pull request #7 from mugurm/master
Fix typos, grammar and broken link.
This commit is contained in:
commit
80b209a8be
18
README.md
18
README.md
|
|
@ -3,16 +3,16 @@
|
||||||
## TODO: move this to the tutorial sub-folder
|
## TODO: move this to the tutorial sub-folder
|
||||||
|
|
||||||
A great way to get introduced to gRPC is to work through this tutorial, which
|
A great way to get introduced to gRPC is to work through this tutorial, which
|
||||||
walks you through the construction of simple client and server that introduces
|
walks you through the construction of a simple client and server and introduces
|
||||||
various features of gRPC.
|
various features of gRPC.
|
||||||
|
|
||||||
When you finish the tutorial, you will be able to
|
When you finish the tutorial, you will be able to
|
||||||
|
|
||||||
- Create a protobuf schema that defines a simple RPC service
|
- Create a protobuf schema that defines a simple RPC service.
|
||||||
- Create a Java server that implements the schema interface
|
- Create a Java server that implements the schema interface.
|
||||||
- Create a Java client that accesses the server
|
- Create a Java client that accesses the server.
|
||||||
- Create a Go client that accesses the Java server
|
- Create a Go client that accesses the Java server.
|
||||||
- Update the service with advanced features like RPC streaming
|
- Update the service with advanced features like RPC streaming.
|
||||||
|
|
||||||
# Get Started
|
# Get Started
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ If you just want to read the tutorial, you can go straight to the next step: [St
|
||||||
# Working with the code
|
# Working with the code
|
||||||
|
|
||||||
You can follow along with this tutorial and hack on the code in the comfort of
|
You can follow along with this tutorial and hack on the code in the comfort of
|
||||||
your own computer. In this way you can get hands-on practice of really writing
|
your own computer. This way you can get hands-on practice of really writing
|
||||||
gRPC code.
|
gRPC code.
|
||||||
|
|
||||||
The tutorial relies on the use of the Git versioning system for source code
|
The tutorial relies on the use of the Git versioning system for source code
|
||||||
|
|
@ -61,7 +61,7 @@ for instructions.
|
||||||
|
|
||||||
# Install Maven
|
# Install Maven
|
||||||
|
|
||||||
To simplify building and the managing of gRPC's dependencies, the java client
|
To simplify building and the managing of gRPC's dependencies, the Java client
|
||||||
are server are structured as a standard [Maven](http://maven.apache.org/guides/getting-started/)
|
are server are structured as a standard [Maven](http://maven.apache.org/guides/getting-started/)
|
||||||
project. See [Install Maven](http://maven.apache.org/users/index.html) for instructions.
|
project. See [Install Maven](http://maven.apache.org/users/index.html) for instructions.
|
||||||
|
|
||||||
|
|
@ -76,6 +76,6 @@ Go gRPC requires Go 1.4, the latest version of Go. See
|
||||||
gRPC uses the latest version of the protocol buffer compiler, protoc.
|
gRPC uses the latest version of the protocol buffer compiler, protoc.
|
||||||
|
|
||||||
For following this tutorial, the protoc is not strictly necessary, as all the
|
For following this tutorial, the protoc is not strictly necessary, as all the
|
||||||
generated code is checked into the Git repository. If you want to experiment
|
generated code is checked into the Git repository. If you want to experiment
|
||||||
with generating the code yourself, download and install protoc from its
|
with generating the code yourself, download and install protoc from its
|
||||||
[Git repo](https://github.com/google/protobuf)
|
[Git repo](https://github.com/google/protobuf)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# Step-0: define a service
|
# Step-0: define a service
|
||||||
|
|
||||||
This section presents an example of a simple service definition that receives
|
This section presents an example of a simple service definition that receives
|
||||||
a message from a remote client. The message contains the users's name and
|
a message from a remote client. The message contains the user's name and
|
||||||
sends back a greeting to that person.
|
sends back a greeting to that person.
|
||||||
|
|
||||||
It's shown below in full; it's actually contained in separate file
|
It's shown below in full; it's actually contained in separate file.
|
||||||
[helloworld.proto](helloworld.proto).
|
[helloworld.proto](src/main/proto/helloworld.proto).
|
||||||
|
|
||||||
```
|
```
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
@ -33,7 +33,7 @@ service Greeting {
|
||||||
```
|
```
|
||||||
|
|
||||||
The service stanza of the message is an example of protobuf service IDL
|
The service stanza of the message is an example of protobuf service IDL
|
||||||
(Interface Defintion Language). Here, it defines a simple service that
|
(Interface Definition Language). Here, it defines a simple service that
|
||||||
receives a request containing a name and returns a response containing a
|
receives a request containing a name and returns a response containing a
|
||||||
message.
|
message.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Step-1: Generate a service client.
|
# Step-1: Generate a service client.
|
||||||
|
|
||||||
In this step, we use protoc to generate the java Stub classes. A Stub is the
|
In this step, we use protoc to generate the Java Stub classes. A Stub is the
|
||||||
name gRPC uses for the code that initiates contact with a gRPC service running
|
name gRPC uses for the code that initiates contact with a gRPC service running
|
||||||
remotely via the internet.
|
remotely via the internet.
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@ First, you'll need to build the protobuf plugin that generates the rpc
|
||||||
classes. `protoc` uses other tools called plugins to add additional features
|
classes. `protoc` uses other tools called plugins to add additional features
|
||||||
to generated code.
|
to generated code.
|
||||||
|
|
||||||
The grpc Java Stub classes are created using a grpc java plugin, but first the
|
The gRPC Java Stub classes are created using a gRPC Java plugin, but first the
|
||||||
plugin must be built and installed.
|
plugin must be built and installed.
|
||||||
|
|
||||||
To build the plugin:
|
To build the plugin:
|
||||||
|
|
|
||||||
10
Step_2.md
10
Step_2.md
|
|
@ -1,15 +1,15 @@
|
||||||
# Step-2: Write a service client.
|
# Step-2: Write a service client.
|
||||||
|
|
||||||
This step uses the generated code to write a simple client to access the hello
|
This step uses the generated code to write a simple client to access the hello
|
||||||
service. The full client is in [GreetingsClient.java](src/main/java/ex/grpc/GreetingsClient.java).
|
service. The full client is in [GreetingsClient.java](src/main/java/ex/grpc/GreetingsClient.java).
|
||||||
|
|
||||||
|
|
||||||
## Configuring the service to connect to.
|
## Configuring the service to connect to.
|
||||||
|
|
||||||
The client contains uses a Stub to contact the service. The internet address
|
The client contains uses a Stub to contact the service. The internet address
|
||||||
is configured in the client constructor. gRPC Channel is the abstraction over
|
is configured in the client constructor. gRPC Channel is the abstraction over
|
||||||
transport handling; its constructor accepts the host name and port of the
|
transport handling; its constructor accepts the host name and port of the
|
||||||
service. The channel in turn is used to construct the Stub.
|
service. The channel in turn is used to construct the Stub.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -77,7 +77,7 @@ implement, build and run a server that supports the service description.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- the client uses a blocking stub. This means that the RPC call waits for the
|
- The client uses a blocking stub. This means that the RPC call waits for the
|
||||||
server to respond, and will either return a response or raise an exception.
|
server to respond, and will either return a response or raise an exception.
|
||||||
|
|
||||||
- gRPC Java has other kinds of stubs that make non-blocking calls to the
|
- gRPC Java has other kinds of stubs that make non-blocking calls to the
|
||||||
|
|
|
||||||
16
Step_3.md
16
Step_3.md
|
|
@ -1,16 +1,16 @@
|
||||||
# Step-3: Implement a server.
|
# Step-3: Implement a server.
|
||||||
|
|
||||||
This step extends the generated server skeleton code to write a simple server
|
This step extends the generated server skeleton code to write a simple server
|
||||||
that provides the hello service. This in introduces two new classes
|
that provides the hello service. This introduces two new classes:
|
||||||
|
|
||||||
- a service implementation [GreetingsImpl.java](src/main/java/ex/grpc/GreetingsImpl.java).
|
- a service implementation [GreetingsImpl.java](src/main/java/ex/grpc/GreetingsImpl.java).
|
||||||
|
|
||||||
- a server that hosts the service implementation and allows to accessed over the network: [GreetingsServer.java](src/main/java/ex/grpc/GreetingsServer.java).
|
- a server that hosts the service implementation and allows access over the network: [GreetingsServer.java](src/main/java/ex/grpc/GreetingsServer.java).
|
||||||
|
|
||||||
## Service implementation
|
## Service implementation
|
||||||
|
|
||||||
[GreetingsSImpl.java](src/main/java/ex/grpc/GreetingsImpl.java)
|
[GreetingsImpl.java](src/main/java/ex/grpc/GreetingsImpl.java)
|
||||||
implements the behaviour we require of our GreetingService. There are a
|
implements the behaviour we require of our GreetingService. There are a
|
||||||
number of important features of gRPC being used here:
|
number of important features of gRPC being used here:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -39,7 +39,7 @@ number of important features of gRPC being used here:
|
||||||
## Server implementation
|
## Server implementation
|
||||||
|
|
||||||
[GreetingsServer.java](src/main/java/ex/grpc/GreetingsServer.java) shows the
|
[GreetingsServer.java](src/main/java/ex/grpc/GreetingsServer.java) shows the
|
||||||
other main feature to required to provde gRPC service; how to allow a service
|
other main feature required to provde the gRPC service; how to allow a service
|
||||||
implementation to be accessed from the network.
|
implementation to be accessed from the network.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -68,14 +68,14 @@ $ mvn package
|
||||||
|
|
||||||
## Try them out
|
## Try them out
|
||||||
|
|
||||||
We've added simple shell scripts to simplifying running the examples. Now
|
We've added simple shell scripts to simplifying running the examples. Now
|
||||||
that they are built, you can run the server with.
|
that they are built, you can run the server with:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ./run_greetings_server.sh
|
$ ./run_greetings_server.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
In another termainal window and confirm that it receives a message.
|
and in another terminal window confirm that it receives a message.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ./run_greetings_client.sh
|
$ ./run_greetings_client.sh
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue