okhttpclient入口的假期
使用OkhttpClient,我可以做以下操作,这将使我在可能的情况下发送请求并处理响应。
okhttpClient
.newCall(request)
.enqueue(
new Callback() {
@Override
public void onResponse(Call arg0, Response arg1) throws IOException {
log.info("Call success", arg1);
}
@Override
public void onFailure(Call arg0, IOException arg1) {
log.info("Call fail", arg1);
}
});
有没有办法用假装来做到这一点?如果有帮助,我已经启用了okhttpclient进行假装吗?
Using OkHttpClient, I can do the following, which would allow me to send the request and process the response when possible.
okhttpClient
.newCall(request)
.enqueue(
new Callback() {
@Override
public void onResponse(Call arg0, Response arg1) throws IOException {
log.info("Call success", arg1);
}
@Override
public void onFailure(Call arg0, IOException arg1) {
log.info("Call fail", arg1);
}
});
Is there a way to do this with Feign? I have enabled the okhttpclient for Feign, if that helps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
See https://github.com/OpenFeign/feign#async-execution-via -completableFuture
由于其OKHTTP客户端不是异步,您要么需要使用
asyncclient.asyncclient(client,executorService),要么更优化地实现Okhttpasyncclient。
或rx
See https://github.com/OpenFeign/feign#async-execution-via-completablefuture
Because their OkHttp client isn't async you would either need to use
AsyncClient.AsyncClient(client, executorService) or more optimally implement an OkHttpAsyncClient.
or RX https://github.com/OpenFeign/feign/tree/master/reactive