grpc / grpc/grpc-java

Add code generation for the advanced server interface

オープン
#339 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
12.1k
フォーク
4k
平均マージ
2日 17時間
マージ済み PR(30日)
37

説明

I asked on the mailing list (https://groups.google.com/forum/#!topic/grpc-io/1RiPC8XYP_U) whether a callback existed to notify the server that a client had disconnected so it could perform some cleanup actions. Here's the answer I received from Eric Anderson:

Because it is a unary request, there isn't a callback that notifies you of client cancellation (any error is considered a cancellation to the server). The next time you call onValue though, an exception will be thrown notifying you of the cancellation. That is enough in some scenarios.

The "advanced" interface provides such notification though. It has onHalfClose (which is when onComplete is normally called), onComplete (when the RPC gracefully completed), and onCancel (if there was an error or if the client cancelled). We don't have code generation for the advanced interface though, so you would need to implement ServerCallHandler for each method in the service, create ServerMethodDefinitions and add them to a ServerServiceDefinition, which is what you pass to the ServerBuilder's addService. That would be verbose and annoying, but simple code. It would probably make sense for you to create an issue for us to add codegen for the advanced interface.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by reading the advanced interface and the manually described ServerCallHandler, ServerMethodDefinitions, ServerServiceDefinition, and ServerBuilder.addService flow. Compare that with the existing generated service path, then define what generated output must provide for onHalfClose, onComplete, and onCancel; done means the advanced interface can be used through code generation rather than per-method manual setup.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api, backend-api-design
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。