aboutsummaryrefslogtreecommitdiff
path: root/chapter/1/gRPC.md
diff options
context:
space:
mode:
authorPaul Grosu <pgrosu@gmail.com>2016-12-07 16:06:48 -0500
committerPaul Grosu <pgrosu@gmail.com>2016-12-07 16:06:48 -0500
commit63e77966fd35ce0cbc88a70615069122ba33a1d9 (patch)
tree1065881dde1a825ed29006a5e98a6fdd5ecd319b /chapter/1/gRPC.md
parent5cbc7c29567b3c893e4069f2a6bc0d5ad27b7489 (diff)
submit
Diffstat (limited to 'chapter/1/gRPC.md')
-rw-r--r--chapter/1/gRPC.md31
1 files changed, 28 insertions, 3 deletions
diff --git a/chapter/1/gRPC.md b/chapter/1/gRPC.md
index 643edaa..953cfdd 100644
--- a/chapter/1/gRPC.md
+++ b/chapter/1/gRPC.md
@@ -175,6 +175,31 @@ The <em>Transport Layer</em> performs the retrieval and placing of binary protoc
The Java implementation of gRPC been built with Mobile platform in mind and to provide that capability it requires JDK 6.0 to be supported. Though the core of gRPC is built with data centers in mind - specifically to support C/C++ for the Linux platform - the Java and Go implementations are two very reliable platform to experiment the microservice ecosystem implementations.
+There are several moving parts to understanding how gRPC-Java works. The first important step is to ensure that the Client and Server stub inferface code get generated by the Protobuf plugin compiler. This is usually placed in your <em>Gradle</em> build file called `build.gradle` as follows:
+
+```
+ compile 'io.grpc:grpc-netty:1.0.1'
+ compile 'io.grpc:grpc-protobuf:1.0.1'
+ compile 'io.grpc:grpc-stub:1.0.1'
+```
+
+When you build using Gradle, then the appropriate base code gets generated for you, which you can override to build your preferred implementation of the Client and Server.
+
+Since one has to implement the HTTP/2 protocol, the chosen method was to have a <em>Metadata</em> class that will convert the key-value pairs into HTTP/2 Headers and vice-versa for the Netty implementation via <em>GrpcHttp2HeadersDecoder</em> and <em>GrpcHttp2OutboundHeaders</em>.
+
+Another key insight is to understand that the code that handles the HTTP/2 conversion for the Client and the Server are being done via the <em>NettyClientHandler.java</em> and <em>NettyServerHandler.java</em> classes shown in Figures 8 and 9.
+
+<p align="center">
+ <img src="figures/grpc-client-transport-handler.png" /><br>
+ <em>Figure 8: The Client Tranport Handler for gRPC-Java.</em>
+</p>
+
+<p align="center">
+ <img src="figures/grpc-server-transport-handler.png" /><br>
+ <em>Figure 9: The Server Tranport Handler for gRPC-Java.</em>
+</p>
+
+
<h3>3.5.1 <em>Downloading gRPC Java</em></h3>
The easiest way to download the gRPC-Java implementation is by performing the following command:
@@ -183,7 +208,7 @@ The easiest way to download the gRPC-Java implementation is by performing the fo
git clone -b v1.0.0 https://github.com/grpc/grpc-java.git
```
-Next compile on a Windows machine using Gradle using the following steps - and if you are using any Firewall software it might be necessary to temporarily disable it while compiling gRPC-Java as sockets are used for the tests:
+Next compile on a Windows machine using Gradle (or Maven) using the following steps - and if you are using any Firewall software it might be necessary to temporarily disable it while compiling gRPC-Java as sockets are used for the tests:
```
cd grpc-java
@@ -216,7 +241,7 @@ You should see the following:
<p align="center">
<img src="figures/hello-world-server.png" /><br>
- <em>Figure 8: The Hello World gRPC Server.</em>
+ <em>Figure 10: The Hello World gRPC Server.</em>
</p>
In the second of the two windows type the following command:
@@ -229,7 +254,7 @@ You should see the following response:
<p align="center">
<img src="figures/hello-world-client.png" /><br>
- <em>Figure 9: The Hello World gRPC Client and the response from the Server.</em>
+ <em>Figure 10: The Hello World gRPC Client and the response from the Server.</em>
</p>
## References