Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,16 @@ public S transactional(boolean handleMessageAdvice) {
/**
* Specify a {@link BiFunction} for customizing {@link Mono} replies via {@link ReactiveRequestHandlerAdvice}.
* @param replyCustomizer the {@link BiFunction} to propagate into {@link ReactiveRequestHandlerAdvice}.
* @param <T> inbound reply payload.
* @param <V> outbound reply payload.
* @return the spec.
* @since 5.3
* @see ReactiveRequestHandlerAdvice
*/
public S customizeMonoReply(BiFunction<Message<?>, Mono<?>, Publisher<?>> replyCustomizer) {
return advice(new ReactiveRequestHandlerAdvice(replyCustomizer));
@SuppressWarnings({ "unchecked", "rawtypes"})
public <T, V> S customizeMonoReply(BiFunction<Message<?>, Mono<T>, Publisher<V>> replyCustomizer) {
return advice(new ReactiveRequestHandlerAdvice(
(BiFunction<Message<?>, Mono<?>, Publisher<?>>) (BiFunction) replyCustomizer));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.WebClientResponseException;
import org.springframework.web.util.UriComponentsBuilder;

import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -422,8 +423,12 @@ public IntegrationFlow webFluxFlowWithReplyPayloadToFlux() {
.id("webFluxWithReplyPayloadToFlux")
.customizeMonoReply(
(message, mono) ->
mono.timeout(Duration.ofMillis(100))
.retry()));
mono.
timeout(Duration.ofMillis(100))
.retry()
.onErrorResume(
WebClientResponseException.NotFound.class,
ex -> Mono.just("Not Found"))));
}

@Bean
Expand Down