reactor.netty.http.client.HttpClient.doOnResponseError()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中reactor.netty.http.client.HttpClient.doOnResponseError()方法的一些代码示例,展示了HttpClient.doOnResponseError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.doOnResponseError()方法的具体详情如下:
包路径:reactor.netty.http.client.HttpClient
类名称:HttpClient
方法名:doOnResponseError

HttpClient.doOnResponseError介绍

[英]Setup a callback called when HttpClientResponse has not been fully received.
[中]设置在未完全接收HttpClientResponse时调用的回调。

代码示例

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
    throws BeansException {
  if (bean instanceof HttpClient) {
    return ((HttpClient) bean).mapConnect(new TracingMapConnect(this.beanFactory))
        .doOnRequest(TracingDoOnRequest.create(this.beanFactory))
        .doOnRequestError(TracingDoOnErrorRequest.create(this.beanFactory))
        .doOnResponse(TracingDoOnResponse.create(this.beanFactory))
        .doOnResponseError(TracingDoOnErrorResponse.create(this.beanFactory));
  }
  return bean;
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core

@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
    throws BeansException {
  if (bean instanceof HttpClient) {
    return ((HttpClient) bean).mapConnect(new TracingMapConnect(this.beanFactory))
        .doOnRequest(TracingDoOnRequest.create(this.beanFactory))
        .doOnRequestError(TracingDoOnErrorRequest.create(this.beanFactory))
        .doOnResponse(TracingDoOnResponse.create(this.beanFactory))
        .doOnResponseError(TracingDoOnErrorResponse.create(this.beanFactory));
  }
  return bean;
}

代码示例来源:origin: reactor/reactor-netty

.doOnRequestError((req, err) ->
  requestError.incrementAndGet())
.doOnResponseError((res, err) ->
  responseError.incrementAndGet())
.get()

相关文章