36 |
37 | 38 |
39 |

Overview

40 |

Demo how to use gRPC with Quarkus. 41 | The quickstart implements the 42 | route guide 43 | example from gRPC Java and consists of a server and client part:

44 |

Server

45 |

The server uses the 46 | Quarkus gRPC extension and 47 | registers a gRPC service and interceptor. The service defines simple unary and streaming methods: 48 |

49 |
service RouteGuide {
 50 |     rpc GetFeature(Point) returns (Feature) {}
 51 | 
 52 |     rpc ListFeatures(Rectangle) returns (stream Feature) {}
 53 | 
 54 |     rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
 55 | }
 56 | 
57 |

Client

58 |

The client serves this page and registers a REST endpoint and two web sockets:

59 |
    60 |
  • The REST endpoint serves as a proxy for the blocking gRPC call to GetFeature
  • 61 |
  • The web sockets implement the streaming calls to the gRPC services ListFeatures 62 | and RouteChat
  • 63 |
64 |

Both the REST endpoint and the websockets use the 65 | Quarkus gRPC client extension 66 | to inject a managed channel and to talk to the gRPC service.

67 |
68 |
69 | 70 |
71 | 72 |
73 |

Get Feature

74 |

A simple RPC.

75 |

Obtains the feature at a given position. If there's no feature at the given position, 76 | 404 will be returned.

77 |

Points are represented as latitude-longitude pairs in the E7 representation (degrees multiplied by 78 | 10**7 and rounded to the nearest integer). Latitudes should be in the range +/- 90 degrees and 79 | longitude should be in the range +/- 180 degrees (inclusive).

80 |

Use (409146138 / -746188906) for a valid response. 83 |

84 |
85 |
86 | 89 |
90 | 94 |

95 | Please provide a valid value for latidude.

96 |
97 |
98 |
99 | 102 |
103 | 107 |

108 | Please provide a valid value for longitude.

109 |
110 |
111 |
112 |
113 |
114 | 115 | 116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 | 124 |
125 | 126 |
127 |

List Features

128 |

A server-to-client streaming RPC.

129 |

Obtains the features available within the given rectangle. Results are streamed rather than 130 | returned at once (e.g. in a response message with a repeated field), as the rectangle may cover a 131 | large area and contain a huge number of features.

132 |

Points are represented as latitude-longitude pairs in the E7 representation (degrees multiplied by 133 | 10**7 and rounded to the nearest integer). Latitudes should be in the range +/- 90 degrees and 134 | longitude should be in the range +/- 180 degrees (inclusive).

135 |

Use 136 | (400000000, -750000000) / (420000000, -730000000) for a valid response.

140 |
141 |
142 | 145 |
146 |
147 | 151 | 155 |
156 |

158 | Please provide valid values for the low point.

159 |
160 |
161 |
162 | 165 |
166 |
167 | 171 | 175 |
176 |

177 | Please provide valid values for the hight point.

178 |
179 |
180 |
181 |
182 |
183 | 184 | 185 |
186 |
187 |
188 |
189 |
190 |

191 |         
192 | 193 |
194 | 195 |
196 |

Route Chat

197 |

A bidirectional streaming RPC.

198 |

Accepts a stream of route notes sent while a route is being traversed, while receiving other 199 | route notes (e.g. from other users).

200 |
201 |
202 | 205 |
206 |
207 | 211 | 3 214 |
215 |

216 | The number of randomly generated route notes.

217 |
218 |
219 |
220 |
221 |
222 | 223 | 224 |
225 |
226 |
227 |
228 |
229 |
230 |