Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc java deadline cancellation #8

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
embed proto snippet
mattnworb committed Mar 18, 2021
commit 4b369fd74acfb64761215c11d6a774e399d037c9
21 changes: 19 additions & 2 deletions content/post/grpc-java-deadline-cancellation-questions.md
Original file line number Diff line number Diff line change
@@ -21,8 +21,25 @@ I'd been meaning to learn how deadlines and cancelled calls work a little
better, and this issue seemed like a good opportunity, so I made a small toy
service to test with: <https://github.com/mattnworb/sleep-service>.

It has a single [gRPC service and RPC method where the caller can ask the server
to sleep for a certain amount of time before responding][sleep-proto].
It has a single gRPC service and RPC method where the caller can ask the server
to sleep for a certain amount of time before responding:

```proto
syntax = "proto3";

package mattnworb.sleep.v1;

message SleepRequest {
int32 sleepTimeMillis = 1;
}
message SleepResponse {
int32 timeSleptMillis = 1;
}
service SleepService {
// Sleep will send back a response after sleeping the requested amount of time in the request message.
rpc Sleep (SleepRequest) returns (SleepResponse) {}
}
```

TODO: explain the code in the repo a bit. Embed the proto definition. Walk through the interceptor that lets us log when a call is started/cancelled/etc.