是否可以使用setReturnImmediately(false)为拉模式设置自定义超时?
当前超时为20秒。
使用Google Cloud Services API客户端Java库。
答案 0 :(得分:0)
HttpRequestInitializer customInit = (request) -> {
credential.initialize(request);
request.setConnectTimeout(3000);
request.setReadTimeout(3000);
};
Pubsub.Builder builder = new Pubsub.Builder(TRANSPORT,
JSON_FACTORY,
credential)
.setHttpRequestInitializer(customInit)
.setApplicationName("app-name");