gRPC server side access timeout deadline?

1,797 views
Skip to first unread message

ili...@luminatewireless.com

unread,
Dec 18, 2015, 6:30:50 PM12/18/15
to grpc.io
Hello,

I'm having trouble finding documentation and/or examples for how a server can get the timeout deadline from a client call. When the client creates the stub, he/she can use something like "withDeadlineAfter(...)" on the stub to indicate a timeout deadline. How can I access this information on the server side from the incoming RPC?

Thanks,
Ilina

Nathaniel Manista

unread,
Dec 18, 2015, 6:42:30 PM12/18/15
to ili...@luminatewireless.com, grpc.io
On Fri, Dec 18, 2015 at 3:30 PM, <ili...@luminatewireless.com> wrote:
I'm having trouble finding documentation and/or examples for how a server can get the timeout deadline from a client call. When the client creates the stub, he/she can use something like "withDeadlineAfter(...)" on the stub to indicate a timeout deadline. How can I access this information on the server side from the incoming RPC?

In what language are you writing your service-side code?
-N

Ilina Mitra

unread,
Dec 18, 2015, 6:43:15 PM12/18/15
to Nathaniel Manista, grpc.io
Java

mat...@lefty.io

unread,
Sep 22, 2016, 10:39:33 AM9/22/16
to grpc.io, ili...@luminatewireless.com
Hello,

I'm having the same trouble finding documentation and/or examples for how a server can get the timeout deadline from a client call. 
Is it possible ?

Thanks,
Mathias

Nathaniel Manista

unread,
Sep 22, 2016, 10:47:17 AM9/22/16
to mat...@lefty.io, grpc.io
On Thu, Sep 22, 2016 at 7:39 AM, <mat...@lefty.io> wrote:
I'm having the same trouble finding documentation and/or examples for how a server can get the timeout deadline from a client call. 
Is it possible ?

In what language are you writing your service-side code?
-Nathaniel

Mathias Chouilly

unread,
Sep 22, 2016, 11:17:20 AM9/22/16
to Nathaniel Manista, grpc.io
In java

Michael Rose

unread,
Sep 27, 2016, 7:29:41 PM9/27/16
to grpc.io, nath...@google.com, mat...@lefty.io
You can access it via the Context:

Deadline deadline = Context.current().getDeadline();

Keep in mind, Context is thread local, so if you dispatch to another thread you'll need to ensure that state is transferred or just extract the Deadline and pass that around.

-MR

mat...@lefty.io

unread,
Sep 28, 2016, 6:55:56 AM9/28/16
to grpc.io, nath...@google.com, mat...@lefty.io, elemen...@gmail.com
This works
Thanks
Reply all
Reply to author
Forward
0 new messages