How to log request and response bodies in Spring WebFlux

This is more or less similar to the situation in Spring MVC. In Spring MVC, you can use a AbstractRequestLoggingFilter filter and ContentCachingRequestWrapper and/or ContentCachingResponseWrapper. Many tradeoffs here: if you’d like to access servlet request attributes, you need to actually read and parse the request body logging the request body means buffering the request body, … Read more

Fire and forget with reactor

1, If your fire-and-forget is already async returning Mono/Flux public Flux<Data> search(SearchRequest request) { return searchService.search(request) .collectList() .doOnNext(data -> doThisAsync(data).subscribe()) // add error logging here or inside doThisAsync .flatMapMany(Flux::fromIterable); } public Mono<Void> doThisAsync(List<Data> data) { //do some async/non-blocking processing here like calling WebClient } 2, If your fire-and-forget does blocking I/O public Flux<Data> search(SearchRequest request) … Read more