I have a Feign client, which is web Reactive Feign, there is a method as responseMapper
, which is implementing ReactiveHttpResponseMapper<Publisher<?>>
. In the apply
method, I need to bring out a byte array and return the original response. But is failed with Rejecting additional inbound receiver. State=\[terminated=false, cancelled=false, pending=0, error=false\]
.
Here is my code snip:
@Bean
public SabreClient sabreServiceClient () {
return WebReactiveFeign.<SabreClient>builder(webClient().mutate())
.options(new WebReactiveOptions.Builder().setConnectTimeoutMillis(config.getConnectTimeOut())
.setReadTimeoutMillis(config.getReadTimeOut())
.setWriteTimeoutMillis(config.getWriteTimeOut())
.setResponseTimeoutMillis(config.getResponseTimeOut()).build())
.addRequestInterceptor(ReactiveHttpRequestInterceptors.addHeader("Cache-Control", "no-cache"))
.addRequestInterceptor(new SabreClientInterceptor(config, loginClient))
.responseMapper(new ResponseMapper())
.target(SabreClient.class, config.getApi());
}
@Log4j2
public class ResponseMapper implements ReactiveHttpResponseMapper<Publisher<?>> {
@Override
public Mono<ReactiveHttpResponse<Publisher<?>>> apply(ReactiveHttpResponse<Publisher<?>> response) {
response.bodyData()
.doOnNext(bytes-> log.info("Received data: {}", new String(bytes)))
.subscribe();
return Mono.just(response);
}
}
I want to receive a String from bytes for some DB stuff and return the original response. Please help me.