servicecomb-java-chassis icon indicating copy to clipboard operation
servicecomb-java-chassis copied to clipboard

如何在handler中获取请求和响应的超时时间

Open ghosts321 opened this issue 1 year ago • 6 comments

如题

ghosts321 avatar Apr 12 '24 02:04 ghosts321

public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {

}

在Invocation和AsyncResponse中没有直接获取请求超时时间的方法,有其他方法能够获取到吗?

ghosts321 avatar Apr 12 '24 03:04 ghosts321

这样做的是解决什么问题了?

liubao68 avatar Apr 15 '24 02:04 liubao68

@liubao68 在执行RPC请求前后进行一些额外的处理,包括处理超时、将RPC请求提交到业务线程池中执行、处理异常等

ghosts321 avatar Apr 15 '24 03:04 ghosts321

可以看看 invocation.getOperationMeta().getConfig().getMsRequestTimeout() 不过你的场景貌似用不到这个值。

liubao68 avatar Apr 15 '24 11:04 liubao68

可以看看 invocation.getOperationMeta().getConfig().getMsRequestTimeout() 不过你的场景貌似用不到这个值。

应该是分别获取生产者和消费者的超时时间,请问有对应的参数吗?

ghosts321 avatar Apr 16 '24 01:04 ghosts321

服务端收到请求后就会一直处理,不存在超时配置。 除非在业务处理过程中增加超时检测。

liubao68 avatar Apr 16 '24 01:04 liubao68