I'm creating ExchangeFilterFunction for extended logging during WebClient requests.
Question: is there any difference if I execute the logging inside the .doOnNext() function in the following example? Or are they equal in processing?
ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
LOGGER.info("Request url=" + clientResponse.url() + ", method=" + clientResponse.method());
return Mono.just(clientRequest);
});
ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
return Mono.just(clientRequest).doOnNext(clientResponse2 -> {
LOGGER.info("Request url=" + clientResponse2.url() + ", method=" + clientResponse2.method());
});
});
Is there any advantage for one over the other?